Skip to content

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

Open

Description

@dxqb

In LTX2Pipeline.__call__ (src/diffusers/pipelines/ltx2/pipeline_ltx2.py), mu is computed with max_image_seq_len passed as the first argument of calculate_shift — the image_seq_len parameter:

mu = calculate_shift(
    self.scheduler.config.get("max_image_seq_len", 4096),   # <-- this is image_seq_len; should be the sample's real sequence length
    self.scheduler.config.get("base_image_seq_len", 1024),
    self.scheduler.config.get("max_image_seq_len", 4096),
    self.scheduler.config.get("base_shift", 0.95),
    self.scheduler.config.get("max_shift", 2.05),
)

calculate_shift(image_seq_len, base, max, base_shift, max_shift) returns image_seq_len * m + b. With image_seq_len == max_seq_len, that reduces to max_shift, so mu is constant regardless of resolution or frame count — use_dynamic_shifting=True has no effect.

image_seq_len should be the sample's packed sequence length, latent_num_frames * latent_height * latent_width — which is already computed a few lines above (and even present as the commented line # video_sequence_length = latent_num_frames * latent_height * latent_width). This matches the Flux/SD3 pipelines and the LTX reference (math.prod(latent.shape[2:])).

Fix: pass latent_num_frames * latent_height * latent_width as the first argument.

Activity

  1. AloysJehwin commented on Aug 3, 2026

    @AloysJehwin
    Contributor

    Opened PR #14373. The fix is two lines — uncomment the existing video_sequence_length line and pass it as image_seq_len. Matches exactly what LTX v1 does in pipeline_ltx.py:725-728.

  2. added a commit that references this issue on Aug 12, 2026
    ffdbe98
  3. added a commit that references this issue on Sep 2, 2026
    6c08500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions