You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: honor per-token audio timesteps in LTX denoising - #2473
Derive LTX-2.x audio token timesteps from the packed denoise mask so a single DGL sample call can preserve reference audio while generating the continuation.
Use per-token timesteps for cross-attention scale and shift, and the global timestep for gates and prompt AdaLN. Keep the existing path when every audio mask value is 1.
Document how to pack the mask and pass the clean reference to sample.
If this PR adds or changes model support, I have added or updated its usage guide and relevant model index/README entries following the model documentation requirements.
Summary by CodeRabbit
New Features
Added support for continuing clips from existing video and audio, with control over which regions are preserved and which are generated.
Documentation
Updated the “Run a script” guide with instructions for preparing video and audio masks and using a reference clip when continuing generation.
No actionable comments were generated in the recent review.
Walkthrough
LTXAV diffusion now derives per-audio-token timesteps from the denoise mask and passes them into the model graph. The documentation describes the mask layout and script setup for continuing a clip from existing video frames and sound.
Changes: LTX-2.x audio mask timesteps
Layer / File(s)
Summary
Forward the denoise mask src/model/diffusion/model.hpp, src/dgl/models/dit.cpp, src/model/diffusion/ltxv.hpp
LTXAVDiffusionExtra adds an optional denoise_mask. DGL passes step.mask, and the diffusion-parameter compute overload forwards the mask to the tensor-based compute method.
Derive and apply audio-token timesteps src/model/diffusion/ltxv.hpp, docs/models/ltx2.md
When the mask and scalar audio timestep meet the stated conditions, the runner derives audio-token timesteps from the packed audio mask and passes the original scalar as a global timestep. The model uses the global timestep for prompt modulation and stream-specific timesteps for cross-attention gates. The documentation describes the mask layout and single-call setup.
sequenceDiagram
participant DGLSample
participant LTXAVDiffusionExtra
participant LTXAVRunner
participant LTXAVModelBlock
DGLSample->>LTXAVDiffusionExtra: pass step.mask as denoise_mask
LTXAVDiffusionExtra->>LTXAVRunner: forward denoise_mask to compute
LTXAVRunner->>LTXAVRunner: derive audio-token timesteps from mask
LTXAVRunner->>LTXAVModelBlock: pass audio and global timesteps
Loading
Merge Risk: Minimal · up to e1dfe
The change lets a single sample call preserve reference audio while generating a continuation, using per-token audio timesteps derived from the denoise mask. Existing behavior is kept when no mask is given or every audio mask value is 1. No concrete merge-blocking defect was established.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix: honor per-token audio timesteps in LTX denoising" names the main change. The PR derives per-audio-token timesteps from the packed denoise mask in the LTXAV diffusion path, so the title…
Description check
The description follows the template. It has a Summary that explains the change and why, a Related Issue section that links #2469, an Additional Information section marked N/A, and a completed checkli…
Linked Issues check
Issue #2469 requests per-audio-token timesteps derived from the audio part of the denoise mask (mask × t), and a rule for the audio-to-video cross-attention modulation when those timesteps differ per …
Out of Scope Changes check
All changed files connect to the issue #2469 objective: - src/model/diffusion/ltxv.hpp: mask-derived audio timesteps, global timestep handling for prompt AdaLN and gates, and the cross-attention rule.…
Full details: Title check
Explanation
The title "fix: honor per-token audio timesteps in LTX denoising" names the main change. The PR derives per-audio-token timesteps from the packed denoise mask in the LTXAV diffusion path, so the title matches the changeset and the linked issue #2469.
Full details: Description check
Explanation
The description follows the template. It has a Summary that explains the change and why, a Related Issue section that links #2469, an Additional Information section marked N/A, and a completed checklist. The Additional Information section states no verification results, which is thin but acceptable for a mostly complete description.
Full details: Linked Issues check
Explanation
Issue #2469 requests per-audio-token timesteps derived from the audio part of the denoise mask (mask × t), and a rule for the audio-to-video cross-attention modulation when those timesteps differ per token.
Evidence at head:
LTXAVRunner::audio_timesteps_from_mask (src/model/diffusion/ltxv.hpp) reads one mask weight per audio time token from the packed audio tail and returns weight * timestep per token. It returns an empty tensor when inputs are ineligible or all weights equal 1. This implements the mask × t requirement.
LTXAVRunner::compute takes denoise_mask (forwarded from LTXAVDiffusionExtra::denoise_mask via src/dgl/models/dit.cpp). When the mask is nonempty and the audio timestep is a single value, it uses the per-token timesteps. The scalar is passed as global_timestep.
LTXAVModelBlock::forward uses per-token timesteps for the cross-attention scale/shift. It uses the global timestep for both cross-attention gates and for prompt AdaLN. This gives a concrete rule for the per-token cross-attention case. The issue lists the generated-token timestep only as an example, so this rule satisfies the stated requirement.
The no-mask path keeps the previous scalar behavior, so existing behavior is unchanged.
Gaps: The PR adds no automated tests for the mask-derived timesteps. The issue does not explicitly require tests. The PR reports no validation results, so runtime behavior of the held-audio result is not confirmed by evidence in this review.
Full details: Out of Scope Changes check
Explanation
All changed files connect to the issue #2469 objective:
src/model/diffusion/ltxv.hpp: mask-derived audio timesteps, global timestep handling for prompt AdaLN and gates, and the cross-attention rule. These are the core of the objective.
src/dgl/models/dit.cpp: forwards step.mask into LTXAVDiffusionExtra. This is required to reach the new mask path.
src/model/diffusion/model.hpp: adds the optional denoise_mask field needed by dit.cpp.
docs/models/ltx2.md: documents how to pack the mask and pass the clean reference to sample. The PR description states this as a stated goal.
No change was found that lacks a connection to the issue objective.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: e5c9abee-4f4c-46e2-9730-21b8f14370c9
Commits
Reviewing files that changed from the base of the PR and between 75b3b99 and e1dfe7a.
Files selected for processing: 4
docs/models/ltx2.md
src/dgl/models/dit.cpp
src/model/diffusion/ltxv.hpp
src/model/diffusion/model.hpp
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
Summary
samplecall can preserve reference audio while generating the continuation.1.sample.Related Issue / Discussion
Fix #2469.
Additional Information
N/A
Checklist
Summary by CodeRabbit
New Features
Documentation