Skip to content

fix: honor per-token audio timesteps in LTX denoising - #2473

Merged
leejet merged 1 commit into
masterfrom
fix/ltx-audio-token-timesteps
Nov 30, 2026
Merged

leejet merged 1 commit into
masterfrom
fix/ltx-audio-token-timesteps

Conversation

@leejet

@leejet leejet commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • 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.

Related Issue / Discussion

Fix #2469.

Additional Information

N/A

Checklist

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.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

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.

[Feature] LTX-2.x: per-token audio timesteps from the denoise mask, so a DGL script can hold audio latents in one sample call

1 participant