Skip to content

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

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 lengthself.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

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