Skip to content

Run the final automatic denoising step in LTX long multi-prompt - #15490

Open
mertkayacs wants to merge 1 commit into
huggingface:mainfrom
mertkayacs:fix/ltx-long-multiprompt-last-step
Open

mertkayacs wants to merge 1 commit into
huggingface:mainfrom
mertkayacs:fix/ltx-long-multiprompt-last-step

Conversation

@mertkayacs

Copy link
Copy Markdown
Contributor

What does this PR do?

The LTX long multi-prompt pipeline dropped the last scheduler timestep in every window, so each window stopped at a positive sigma. I now keep every automatic timestep and trim the final entry only when explicit sigmas end in zero. num_timesteps matches the loop that actually runs.

Fixes #15460

I used Codex to help write, test, and self-review the change.

Verification

pytest tests/pipelines/ltx/test_ltx_i2v_long_multi_prompt.py
7 failed (old timestep selection), 7 passed (this PR)
ruff check / ruff format --check on both files: passed
utils/check_copies.py, utils/check_dummies.py: passed

I also ran the full pipeline with tiny random components on HF Jobs CPU (two windows, num_inference_steps=2). Before the fix, each window made one transformer call and ended at sigma 0.001. With the fix, each window made two calls and ended at 0.0, for both FlowMatch and the LTX ancestral RF scheduler.

Final self-review (READY). I traced the window reset through the loop and scheduler.step and found no blocking issues or dead code. The NumPy warnings in the test come from FlowMatch's existing np.array(sigmas) conversion. An explicit ancestral input ending above zero keeps every entry; the scheduler already warns about that case, so I left scheduler behavior out of this patch.

Before submitting

  • Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
    • Did you read the Coding with AI agents guide?
    • Did you run the self-review skill on the diff?
    • Did you share the final self-review notes in the PR description or a comment?
  • Did you read the contributor guideline?
  • Did you read our philosophy doc? (important for complex PRs)
  • Was this discussed/approved via a GitHub issue or GitHub Discussions? Please add a link to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the documentation guidelines, and here are tips on formatting docstrings.
  • Did you write any new necessary tests?
  • Are you the author (or part of the team we work with) of the model/pipeline this PR relates to?

Who can review?

LTX pipeline maintainers.

@mertkayacs

Copy link
Copy Markdown
Contributor Author

@yaoqih @sayakpaul could one of you review this when you have time? The test covers the final step that was skipped.

@yaoqih

yaoqih commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

@yaoqih @sayakpaul could one of you review this when you have time? The test covers the final step that was skipped.

Thanks for fixing the missing step for automatically generated schedules. I confirmed that all four windows now run 8 steps and reach sigma 0 in the 361-frame LTX run. One edge case remains with explicit sigmas and FlowMatchEulerDiscreteScheduler(shift_terminal=0.1). The scheduler transforms the supplied terminal 0.0 to 0.1 and appends the actual terminal 0.0, but _prepare_timesteps decides whether to trim a timestep from the original input sigmas. As a result, each window runs 8 steps and stops at sigma ≈0.1, skipping the final 0.1 → 0 transition. The resulting video also diverges visibly from the run that executes this final step. Could you base the trimming decision on the scheduler’s processed schedule and add a regression test for this shift_terminal case? Please retain coverage for the default explicit schedule ending in 0.0 to ensure it does not run the redundant 0.0 → 0.0 step. I recommend requesting changes until this case is covered.

This branch has not been deployed

No deployments
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.

LTX long multi-prompt drops the last automatic denoising step

2 participants