Skip to content

Conversation

@Mr-Neutr0n
Copy link

Summary

  • Fix DDIMScheduler.step() to correctly compute prev_timestep when timestep_spacing is set to linspace or trailing
  • The previous implementation used a hard-coded formula (timestep - num_train_timesteps // num_inference_steps) that only produces correct values for timestep_spacing="leading"
  • Replace with a previous_timestep() method that looks up the next timestep from self.timesteps, consistent with the approach already used in DDPMScheduler

Fixes #12633

Test plan

  • Verify DDIM sampling produces correct results with timestep_spacing="linspace"
  • Verify DDIM sampling produces correct results with timestep_spacing="trailing"
  • Verify no regression with default timestep_spacing="leading"

When timestep_spacing is set to 'linspace' or 'trailing', the formula
timestep - num_train_timesteps // num_inference_steps does not produce
the correct previous timestep. Use a lookup into self.timesteps instead,
matching the approach used in DDPMScheduler.previous_timestep().
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.

DDIMScheduler.step() logic mismatches set_timesteps() list when using timestep_spacing='linspace'

1 participant