LTX-2
LTX-2 copied to clipboard
Limit seq_length to max_tokens in timestep_samplers
Problem
When seq_length exceeds max_tokens (4096), _get_shift_for_sequence_length
computes an unbounded mu (e.g. seq_len=93060 → mu≈34). Both percentile bounds
saturate at 1.0, causing division by zero in zero_terminal_raw and NaN sigmas.
This propagates to noised latents and loss, crashing training.
Fix
Clamp seq_length to max_tokens before computing the shift, matching the
inference-side LTX2Scheduler anchor range (1024–4096 → shift 0.95–2.05).
Verification
| Before | After | |
|---|---|---|
| seq_len | 93060 | (capped to 4096) |
| percentile_999 / 005 | 1.0 / 1.0 | ~0.99 / ~0.37 |
| zero_terminal_raw | NaN | ~0.85 |