Fix LTX-2 context parallel plan and Ulysses attn mask head sharding - #14317
Open
PaulFidika wants to merge 1 commit into
Open
Fix LTX-2 context parallel plan and Ulysses attn mask head sharding#14317PaulFidika wants to merge 1 commit into
PaulFidika wants to merge 1 commit into
Conversation
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.
LTX-2's
_cp_planwas a copy of LTX-1's, soenable_parallelism()crashed on the per-token timestep and never sharded the audio stream or 3 of the 4 RoPE modules — and sharding video only would be silently wrong for the bidirectional a2v/v2a cross-attention. The plan is now set in__init__because the RoPE sequence dim depends on config:(B, T, D)forrope_type="interleaved"vs(B, H, T, D//2)for"split"(what the released checkpoint uses). Two adjacent fixes this surfaced:TemplatedUlyssesAttentionnow shards a 4-D attn mask's head axis to match the post-all-to-all QKV heads, and the CP hook now skips planned params the caller didn't pass (LTX-2's optionalaudio_timestep) instead of raising.CPU repro from #14316 on this branch (2 ranks, gloo, built-in plan, both rope types):
Also validated on 2xH100 (NVLink) with the released
Lightricks/LTX-2checkpoint (LTX2Pipeline, 1280x704, 121 frames, bf16): a single transformer forward underulysses_degree=2matches single-GPU exactly (fp32 max|delta| <= 4.2e-7, bf16 bitwise on a small config), and the full 20-step run produces the same video+audio take with bf16 accumulation drift 4-9x below the delta between two seeds (latent rel-RMS 0.21 vs 0.92 video, 0.07 vs 0.62 audio).The two remaining gaps stay tracked in #14316: the
(B, T_v, T_v)IC-LoRA self-attention mask (not expressible as a plan entry) and theulysses_anythingmask path. Fixes #14316.