Skip to content

fix: clamp interactive num_latent_chunk to max(cumulative), not sum - #137

Open
smcshahid wants to merge 1 commit into
PKU-YuanGroup:mainfrom
smcshahid:fix/interactive-chunk-clamp
Open

fix: clamp interactive num_latent_chunk to max(cumulative), not sum#137
smcshahid wants to merge 1 commit into
PKU-YuanGroup:mainfrom
smcshahid:fix/interactive-chunk-clamp

Conversation

@smcshahid

Copy link
Copy Markdown

What

One-line fix: the interactive-mode chunk-count clamp uses sum(interpolate_cumulative_list) where the intent is max(...).

interpolate_cumulative_list is already cumulative (itertools.accumulate of interpolate_time_list). When the requested num_frames is below the schedule's end, summing the cumulative list grows quadratically in prompt count: with the bundled example CSV (6 prompts × 7 chunks → cumulative [7,14,21,28,35,42]) a 693-frame request becomes 147 chunks = 4,851 frames (~3.4 min of video), which then OOMs at postprocess_video on an 80 GB H100. Because the CLI batch loop swallows exceptions, the process exits 0 with no output.

Fixes #136

Compatibility / regression

  • No API change. Requests ≥ the schedule length never enter this branch — outputs unchanged.
  • The only behavioral change is for requests that currently explode and OOM: they now produce the schedule-length video (max(cumulative) chunks — exactly enough for every prompt interval).
  • Verified at the boundary: the 6-prompt example at ≥42 chunks renders 1,449 frames in 165 s (H100, seed 42).

🤖 Generated with Claude Code

interpolate_cumulative_list is already cumulative (itertools.accumulate of
interpolate_time_list). When the requested chunk count is below the schedule,
the intended clamp is the schedule's end - max(...). sum(...) over an
already-cumulative list grows quadratically in prompt count: with the shipped
example CSV (6 prompts x 7 chunks) a 693-frame request becomes 147 chunks
(4,851 frames, ~3.4 min of video) and then OOMs at postprocess on an 80 GB
H100. Requests >= the schedule length are unaffected (the branch never fires),
which is why the official 1,452-frame example script masks the bug.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants