Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Stabilize the sampling of DPM-Solver++ by a stabilizing trick #4377

Closed
1 task done
LuChengTHU opened this issue Nov 6, 2022 · 5 comments
Closed
1 task done

Comments

@LuChengTHU
Copy link

LuChengTHU commented Nov 6, 2022

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Thank you for the support for DPM-Solver++! The examples in #4304 are so amazing!

However, the current implementations for DPM-Solver++ suffer from instability issues for steps <= 10. It can be further improved by a stabilizing trick. Please see this issue for details: crowsonkb/k-diffusion#43

Feature request: Stabilize the sampling of DPM-Solver++ by a stabilizing trick, which can further stabilize the sampling by DPM-Solver++ for steps <= 10

Proposed workflow

Support the stabilizing trick

Additional information

No response

@aliencaocao
Copy link
Contributor

+1
Observed the same issue when using it, kind of pity because the main advantage with DPM solver is the low steps required for a good image.
Just to add (for those that did not know) this guy is the first author of the paper that proposed DPM solver++ so whatever he is saying definitely has some credibility there.

@LuChengTHU
Copy link
Author

LuChengTHU commented Nov 6, 2022

+1 Observed the same issue when using it, kind of pity because the main advantage with DPM solver is the low steps required for a good image. Just to add (for those that did not know) this guy is the first author of the paper that proposed DPM solver++ so whatever he is saying definitely has some credibility there.

Haha, thank you! Sorry to forget to introduce myself. I'm the first author of both DPM-Solver and DPM-Solver++. Thanks to the community, our proposed solvers are widely used in many applications of diffusion models.

In my recent experience, the "stabilizing" trick I mentioned here is a key to stabilizing DPM-Solver++2M, and I have implemented it in my PR to diffusers: huggingface/diffusers#1132. I believe the proposed DPM-Solver++2M will be the next-generation trend for accelerating the sampling by diffusion models!

@LuChengTHU LuChengTHU changed the title [Feature Request]: Stabilize the sampling of DPM-Solver++ by a denoising trick [Feature Request]: Stabilize the sampling of DPM-Solver++ by a stabilizing trick Nov 6, 2022
@LuChengTHU
Copy link
Author

@hentailord85ez
Copy link
Collaborator

Looking at k-diffusion's current implementation of 2M and if I understand correctly, it seems like it is already doing this.

I've modified the inner loop of the 2M implementation to print whether it's doing order 1 or order 2:

        if old_denoised is None or sigmas[i + 1] == 0:
            order_1...
            print("O1")
        else:
            order_2...
            print("O2")

With S = 5, it does 1 step of order 1, 3 steps of order 2, and then 1 final step of order 1.

@ClashSAN
Copy link
Collaborator

@hentailord85ez so, these improvements are already in?

for

DPM++ 2M
DPM++ 2M Karras
DPM++ 2S
DPM++ 2S a Karras

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

No branches or pull requests

4 participants