Skip to content

Conversation

bhzhang2001
Copy link

What does this PR do?

This PR fixes a bug in DPMSolverMultistepInverseScheduler where the sigmas used in flow_prediction were not properly inverted.

Previously, the scheduler directly used forward sigmas, which led to inconsistencies during inverse diffusion steps.

This PR ensures that the sigmas are correctly inverted before being applied in flow_prediction, aligning the behavior with the intended inverse process.

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR!
I left a comment

@@ -299,7 +299,9 @@ def set_timesteps(self, num_inference_steps: int = None, device: Union[str, torc
elif self.config.use_flow_sigmas:
alphas = np.linspace(1, 1 / self.config.num_train_timesteps, num_inference_steps + 1)
sigmas = 1.0 - alphas
sigmas = np.flip(self.config.flow_shift * sigmas / (1 + (self.config.flow_shift - 1) * sigmas))[:-1].copy()
sigmas = np.flip(self.config.flow_shift * sigmas / (1 + (self.config.flow_shift - 1) * sigmas))[:-1][
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it same as this?

sigmas = (self.config.flow_shift * sigmas / (1 + (self.config.flow_shift - 1) * sigmas))[1:].copy()

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

Successfully merging this pull request may close these issues.

3 participants