Skip to content

fix(ltx2): pass actual sequence length to calculate_shift for dynamic timestep shift - #14373

Open
AloysJehwin wants to merge 1 commit into
huggingface:mainfrom
AloysJehwin:fix/ltx2-dynamic-timestep-shift
Open

fix(ltx2): pass actual sequence length to calculate_shift for dynamic timestep shift#14373
AloysJehwin wants to merge 1 commit into
huggingface:mainfrom
AloysJehwin:fix/ltx2-dynamic-timestep-shift

Conversation

@AloysJehwin

@AloysJehwin AloysJehwin commented Aug 3, 2026

Copy link
Copy Markdown

Fixes #14243

The issue is that mu in LTX2Pipeline was always max_shift regardless of resolution or frame count. Traced it to calculate_shift being called with max_image_seq_len as both the first argument (image_seq_len) and the third (max). Since the function is linear in image_seq_len, passing the max as input always returns the max output — so use_dynamic_shifting=True does nothing.

There was already a commented-out line # video_sequence_length = latent_num_frames * latent_height * latent_width right above. Uncommented it and used it as the first arg. Same approach as the LTX v1 pipeline at pipeline_ltx.py:725-728.

… timestep shift

LTX2Pipeline passed max_image_seq_len as the first argument to
calculate_shift(), which also receives it as the third argument (the
maximum). Since calculate_shift returns image_seq_len * m + b, passing
the maximum as image_seq_len always returns max_shift — making mu
constant regardless of resolution or frame count.

The commented-out line below already computed the correct value.
Uncommented it and passed video_sequence_length as image_seq_len,
matching LTX v1 pipeline (pipeline_ltx.py:725-728) and the LTX
reference implementation.

Fixes huggingface#14243

Signed-off-by: Aloys Jehwin <aloysjehwin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LTX2Pipeline: dynamic timestep shift mu is constant, ignores the actual sequence length

1 participant