Limit seq_length to max_tokens in timestep_samplers#230
Open
lsl0007 wants to merge 1 commit into
Open
Conversation
Cap sequence length to max_tokens to prevent NaN errors.(Without this cap, very large seq_length drives mu up, both percentile bounds saturate near 1.0, and zero_terminal_raw divides by ~0 → NaN.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
seq_lengthexceedsmax_tokens(4096),_get_shift_for_sequence_lengthcomputes an unbounded
mu(e.g. seq_len=93060 → mu≈34). Both percentile boundssaturate at 1.0, causing division by zero in
zero_terminal_rawand NaN sigmas.This propagates to noised latents and loss, crashing training.
Fix
Clamp
seq_lengthtomax_tokensbefore computing the shift, matching theinference-side
LTX2Scheduleranchor range (1024–4096 → shift 0.95–2.05).Verification