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

How can we use DPM++ 2M Karras sampler in Diffusers? #1887

Closed
danishboy000 opened this issue Jan 2, 2023 · 10 comments
Closed

How can we use DPM++ 2M Karras sampler in Diffusers? #1887

danishboy000 opened this issue Jan 2, 2023 · 10 comments
Assignees
Labels
stale Issues that haven't received updates

Comments

@danishboy000
Copy link

I'm trying to use the latest samplers which provide better performance with stable diffusion in the diffusers library, but I couldn't find DPM++ 2M Karras sampler in the library. These samplers are present in Automatic111. Can anyone guide me on how to use these samplers in the Diffusers library?

@patrickvonplaten
Copy link
Contributor

I'm trying to use the latest samplers which provide better performance with stable diffusion in the diffusers library, but I couldn't find DPM++ 2M Karras sampler in the library. These samplers are present in Automatic111. Can anyone guide me on how to use these samplers in the Diffusers library?

Hey, this should be identical to this scheduler: https://huggingface.co/docs/diffusers/api/schedulers/multistep_dpm_solver

Could you try using this one to see if quality matches the one of Auto1111.

@danishboy000
Copy link
Author

I tried this and the quality didn't match.

@pcuenca
Copy link
Member

pcuenca commented Jan 4, 2023

I think @danishboy000 might be referring to the use of Karras sigmas #1633 in combination with this scheduler's algorithm, but I'm not an expert in Automatic1111 nomenclature. Perhaps @apolinario can confirm?

@apolinario
Copy link
Contributor

Yes that is correct!

@patrickvonplaten
Copy link
Contributor

@danishboy000 could you copy-paste some code snippets that you used for Auto1111 and diffusers for comparison?

@apolinario
Copy link
Contributor

@patrickvonplaten , I think in this issue #1633 I showcase the code snippet used by AUTO1111 for using Karras sigmas for all samplers

@patrickvonplaten patrickvonplaten self-assigned this Jan 20, 2023
@Stax124
Copy link
Contributor

Stax124 commented Jan 21, 2023

@patrickvonplaten I was able to get KDiffusion samplers with Karras sigmas with some modifications to your KDiffusion experimental model:

https://github.com/Stax124/voltaML-fast-stable-diffusion/blob/4b6a23c5a09ee6375b6dbc86ba1d207df80eea7b/core/diffusers/kdiffusion/KDiffusionModel.py#L513

I am getting similar results to A111 (using AnythingV4 - there are multiple versions of the checkpoint, hence the tiny change, quality-wise seems good to me)

Volta:
download (2)

A111:
00000-420

I would make a PR but I am busy right now, so if you have someone that can take a look at it, feel free to add it.
If not, I will create a PR in the future, but no idea when that will happen.

PS - There are more optimizations in the model, callback was implemented as well.

Thanks for the hard work on diffusers, we really appreciate it.

@patrickvonplaten
Copy link
Contributor

Very cool, thanks a lot @Stax124 :-)

We have an open issue to add karras sigmas to diffusers, I'll link it to your work already thanks a lot :-)

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@github-actions github-actions bot added the stale Issues that haven't received updates label Feb 16, 2023
@Kenshiro-28
Copy link

Is now possible to use DPM++ 2M Karras on DiffusionPipeline? I'm using custom_pipeline = "lpw_stable_diffusion"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues that haven't received updates
Projects
None yet
Development

No branches or pull requests

6 participants