Skip to content

Fix LTX2 VAE widths and dynamic shift coverage - #3008

Open
bghira wants to merge 2 commits into
mainfrom
agent/ltx2-vae-and-shift-fixes
Open

Fix LTX2 VAE widths and dynamic shift coverage#3008
bghira wants to merge 2 commits into
mainfrom
agent/ltx2-vae-and-shift-fixes

Conversation

@bghira

@bghira bghira commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes LTX Video 2 VAE decoder channel handling and adds regression coverage for dynamic-shift sequence length selection.

Details

  • Projects decoder up-block inputs to the upsampler width when the incoming channel count differs from the required width.
  • Keeps matching-width up-blocks from adding an unnecessary projection.
  • Adds AST-based regression coverage that text-to-video and image-to-video LTX2 pipelines pass the actual video_sequence_length into calculate_shift.

Validation

  • .venv/bin/python -m unittest -v -f tests.test_ltxvideo2_autoencoder tests.test_ltxvideo2_dynamic_shift

bghira added 2 commits August 6, 2026 13:21
Compute LTX2 decoder up-block input channels from the current decoder width and project mismatched inputs to the upsampler width before upsampling.

This keeps non-nominal constant-width decoder configurations from sending tensors with the wrong channel count into the 3D upsampler path.

Add tests for projection, projection skipping, and a compact decoder shape that previously failed with mismatched widths.
Add AST-based regression coverage that both LTX Video 2 text-to-video and image-to-video pipelines pass the actual video_sequence_length into calculate_shift.

This guards against reverting to shape assumptions that undercount the packed video sequence when dynamic timestep shifting is enabled.
@bghira
bghira marked this pull request as ready for review August 6, 2026 19:46
@bghira
bghira requested a lite review from Copilot August 6, 2026 19:46

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds regression tests and adjusts the LTXVideo2 autoencoder upsampling path so channel dimensions align correctly during upsampling and decoding.

Changes:

  • Add AST-based tests to ensure calculate_shift is invoked using video_sequence_length in LTX2 pipelines.
  • Expand autoencoder unit tests to validate LTX2VideoUpBlock3d channel projection behavior and decoder constant-width configs.
  • Update LTX2VideoUpBlock3d to project inputs to the upsampler width and adjust decoder up-block channel wiring.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/test_ltxvideo2_dynamic_shift.py New regression test ensuring dynamic shift uses actual video sequence length.
tests/test_ltxvideo2_autoencoder.py New tests covering up-block channel projection and decoder constant-width acceptance.
simpletuner/helpers/models/ltxvideo2/autoencoder.py Adjust up-block conv_in channel logic and decoder up-block input channel computation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +666 to +670
upsampler_in_channels = out_channels * upscale_factor
if in_channels != upsampler_in_channels:
self.conv_in = LTX2VideoResnetBlock3d(
in_channels=in_channels,
out_channels=out_channels,
out_channels=upsampler_in_channels,
calls = _calculate_shift_calls(tree)

self.assertEqual(len(calls), 1)
self.assertEqual(ast.unparse(calls[0].args[0]), "video_sequence_length")
Comment on lines +27 to +28
self.assertEqual(len(calls), 1)
self.assertEqual(ast.unparse(calls[0].args[0]), "video_sequence_length")
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