LCMScheduler advances the generator on the final step of a strength-truncated custom schedule

Open
#15,368 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@SIDDARTHAREDDY8 is already working on this.

Since Nov 20, 2026.

  • #15364 by @SIDDARTHAREDDY8 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
30/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, pytorch

Research direction

Read LCMScheduler.step and compare it with the TCDScheduler change from #15301, which fixed the same final-step check. Reproduce with a seeded generator and a truncated schedule (timesteps=[999, 499, 19], strength=0.5), then use the regression test test_truncated_custom_timesteps_final_step_preserves_generator from #15364 as the done signal. Note that a fix is already proposed in #15364, so coordinate there before starting.

Written by the indexing model from the issue text.

Description

Describe the bug

When LCMScheduler uses a non-empty custom timestep schedule truncated by strength < 1, its actual final step advances the supplied random generator even though the sampled noise is never used.

For example, timesteps=[999, 499, 19] with strength=0.5 leaves only [19], but num_inference_steps remains 3. The final-step check uses the original step count and enters the noise-sampling branch.

Same bug class as #15288 (fixed for TCDScheduler in #15301); a follow-up to the review on #15301, which suggested applying the same one-line change to LCMScheduler.step. A fix is proposed in #15364.

Reproduction

Call LCMScheduler.step with a truncated custom schedule (e.g. timesteps=[999, 499, 19], strength=0.5) and a seeded generator: the generator state advances on the final step on unpatched code. Regression test test_truncated_custom_timesteps_final_step_preserves_generator in #15364 fails on unpatched code and passes with the fix.

Expected behavior

The generator state should be untouched on the actual final step of the truncated schedule.

Dominant language
Python
Stars
35k
Forks
7.5k
Avg merge
2d 22h
Merged PRs (30d)
58

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/diffusers

All issues in huggingface/diffusers

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.