-
Notifications
You must be signed in to change notification settings - Fork 6k
Add support Karras sigmas
for StableDiffusionKDiffusionPipeline
#2874
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
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Very clean! Could you just run |
@patrickvonplaten thanks! I just fixed it. |
use_karras_sigmas (`bool`, *optional*, defaults to `False`): | ||
Use karras sigmas. For example, specifying `sample_dpmpp_2m` to `set_scheduler` will be equivalent to | ||
`DPM++2M` in stable-diffusion-webui. On top of that, setting this option to True will make it `DPM++2M | ||
Karras`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how docstrings should be I think.
Could you maybe just add a link to the paper that introduced Karras sigmas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayakpaul Thanks for merging! The so-called Karras Sigmas
corresponds to Eq. 5 in the paper. Since I missed the timing, could you please include a citation as a comment when your working on #2905?
Karras, T. (2022, June 1). Elucidating the Design Space of Diffusion-Based Generative Models. arXiv.org. https://arxiv.org/abs/2206.00364
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love everything about this PR.
Changes introduced, PR description, and the considerations given to it.
Well done!
…ggingface#2874) * add use_karras_sigmas option thanks @Stax124 * fix sigma_min/max from scheduler.sigmas * add docstring * revert to use k_diffusion_model.sigma, to(device) * add integration test * make style
@takuma104 out of curiosity, why was this functionality implemented in a separate pipeline than StableDiffusionPipeline rather than as a scheduler for StableDiffusionPipeline? |
@alexisrolland Currently, there is a |
I was looking for all the available samplers. The list is here https://github.com/crowsonkb/k-diffusion/blob/master/k_diffusion/sampling.py
In case anyone is interested. |
…ggingface#2874) * add use_karras_sigmas option thanks @Stax124 * fix sigma_min/max from scheduler.sigmas * add docstring * revert to use k_diffusion_model.sigma, to(device) * add integration test * make style
…ggingface#2874) * add use_karras_sigmas option thanks @Stax124 * fix sigma_min/max from scheduler.sigmas * add docstring * revert to use k_diffusion_model.sigma, to(device) * add integration test * make style
This PR adds an option
use_karras_sigmas=
to apply theKarras sigmas
discussed in issues like #1633, #2801 for theStableDiffusionKDiffusionPipeline
. The original code is mostly by @Stax124, with some modifications made to apply it to the latestStableDiffusionKDiffusionPipeline
. I opened this PR because the topic ofDPM++ 2M Karras
has come up repeatedly, and I personally wanted to use it.Usage:
Effectiveness:
The sigmas seem to change slightly like this.
Default:
Use Karras option:
Test:
The integration tests have passed
(although there is no coverage for the additional code). For generation test, I couldn't verify pixel matching, but the results seem to be close to those ofDPM++ 2M Karras
in stable-diffusion-webui.DPM++ 2M Karras
optionuse_karras_sigmas=True
use_karras_sigmas=False