Skip to content

schedulers/scheduling_dpmsolver_multistep: round timesteps for exponential and beta sigma schedules#13768

Open
Dev-X25874 wants to merge 1 commit into
huggingface:mainfrom
Dev-X25874:fix/dpmsolver-timestep-rounding-exponential-beta
Open

schedulers/scheduling_dpmsolver_multistep: round timesteps for exponential and beta sigma schedules#13768
Dev-X25874 wants to merge 1 commit into
huggingface:mainfrom
Dev-X25874:fix/dpmsolver-timestep-rounding-exponential-beta

Conversation

@Dev-X25874
Copy link
Copy Markdown
Contributor

What does this PR do?

In DPMSolverMultistepScheduler.set_timesteps, the use_karras_sigmas and
use_lu_lambdas branches both call timesteps.round() after computing
timesteps via _sigma_to_t (which returns floating-point values through
interpolation), before those timesteps are cast to torch.int64.

The use_exponential_sigmas and use_beta_sigmas branches were missing this
.round() call, causing raw float values to be truncated (not rounded) on
the torch.int64 cast at the end of set_timesteps. This silently introduces
a systematic off-by-one error in the noise schedule index lookup whenever
either of these two sigma modes is used with this scheduler.

This PR adds timesteps = timesteps.round() to both branches, consistent with
the existing pattern already established by use_karras_sigmas and
use_lu_lambdas.

Fixes # (issue)

Before submitting

Who can review?

@DN6

@github-actions github-actions Bot added size/S PR with diff < 50 LOC schedulers and removed size/S PR with diff < 50 LOC labels May 20, 2026
@Dev-X25874 Dev-X25874 closed this May 20, 2026
@Dev-X25874 Dev-X25874 deleted the fix/dpmsolver-timestep-rounding-exponential-beta branch May 20, 2026 05:59
@Dev-X25874 Dev-X25874 restored the fix/dpmsolver-timestep-rounding-exponential-beta branch May 28, 2026 05:20
@Dev-X25874 Dev-X25874 reopened this May 28, 2026
@github-actions github-actions Bot added the size/S PR with diff < 50 LOC label May 28, 2026
@Dev-X25874 Dev-X25874 force-pushed the fix/dpmsolver-timestep-rounding-exponential-beta branch from 419797d to 5c83f8b Compare May 28, 2026 05:22
@Dev-X25874
Copy link
Copy Markdown
Contributor Author

Hey @DN6 — could you please take a look at this PR when you get a chance? It fixes a silent off-by-one error in DPMSolverMultistepScheduler.set_timesteps where the use_exponential_sigmas and use_beta_sigmas branches were missing a .round() call before the torch.int64 cast — causing float truncation instead of rounding. The use_karras_sigmas and use_lu_lambdas branches already do this correctly; this PR just brings the other two in line. Two-line fix, no behaviour change for any other code path. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

schedulers size/S PR with diff < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant