Add support Karras sigmas for StableDiffusionKDiffusionPipeline#2874
Add support Karras sigmas for StableDiffusionKDiffusionPipeline#2874sayakpaul merged 11 commits intohuggingface:mainfrom
Karras sigmas for StableDiffusionKDiffusionPipeline#2874Conversation
|
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.
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.
@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
sayakpaul
left a comment
There was a problem hiding this comment.
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 sigmasdiscussed 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 Karrashas 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 Karrasin stable-diffusion-webui.DPM++ 2M Karrasoptionuse_karras_sigmas=Trueuse_karras_sigmas=False