Skip to content

refactor(train): unify data classes and add LTX2 support#1244

Merged
gushiqiao merged 9 commits into
mainfrom
gsq/dev-train-reco
Jul 15, 2026
Merged

refactor(train): unify data classes and add LTX2 support#1244
gushiqiao merged 9 commits into
mainfrom
gsq/dev-train-reco

Conversation

@gushiqiao

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces significant structural changes to the training and inference pipeline, including the addition of new model components, improved data loading mechanisms, and memory-efficient decoding strategies. The review identified several critical and high-severity issues, including potential crashes during compilation due to type mismatches in attention masks, runtime errors when handling missing video paths, platform-specific overflow errors in CSV processing, and security risks related to insecure deserialization of .pt files. I have filtered out comments that provided validation without actionable feedback or focused on non-code changes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +63 to +69
cross_attn_type: PerturbationType,
) -> "TransformerArgs":
device, dtype = args.x.device, args.x.dtype

all_self = perturbations.all_in_batch(self_attn_type, block_idx)
any_self = perturbations.any_in_batch(self_attn_type, block_idx)
self_mask: torch.Tensor | None = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

If args.self_attention_mask is a BlockMask (which is returned by the new FlexAttention mask preparation functions), accessing .shape or calling torch._dynamo.mark_dynamic on it will raise an AttributeError because BlockMask is not a Tensor. Adding an isinstance(..., torch.Tensor) check prevents compilation crashes.

        if args.self_attention_mask is not None and isinstance(args.self_attention_mask, torch.Tensor):
            # Dense form is (B, 1, T, T); key-padding form (from the SP wrapper)
            # is (B, 1, 1, T) -- leave the size-1 query dim static so Dynamo
            # keeps the broadcast.
            if args.self_attention_mask.shape[2] > 1:
                torch._dynamo.mark_dynamic(args.self_attention_mask, 2)
            torch._dynamo.mark_dynamic(args.self_attention_mask, 3)

Comment thread lightx2v_train/lightx2v_train/model_zoo/native/ltx2/ltx_core/loader/registry.py Outdated
@gushiqiao gushiqiao changed the title recon data cls and support ltx2 refactor(train): unify data classes and add LTX2 support Jul 15, 2026
gushiqiao and others added 2 commits July 15, 2026 10:43
…oader/registry.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gushiqiao
gushiqiao merged commit 90bb178 into main Jul 15, 2026
2 checks passed
@gushiqiao
gushiqiao deleted the gsq/dev-train-reco branch July 15, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants