-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Update K-Diffusion and include noise scheduler script #1560
Update K-Diffusion and include noise scheduler script #1560
Conversation
It would be awesome if the alternate noise schedules could run alongside other scripts too, would really like to use it with SD upscaling. Liking the results I'm getting from img2img. |
the script should still go to wiki |
So, dumb question...but if it improves output and it "seems to be the intended way", why not just make it an advanced setting option for people who don't care about breaking seeds and just want their pics to look awesome (like myself)? As you pointed out, because it's a script, it's somewhat restricted in usage. I'd be all for leaving the default alone, and just adding this as an optional setting. |
Also, updating the commit hash doesn't actually change anything ATM, unless you install new. The "git_clone" command within the launch script just returns if the directory already exists, meaning they'll never be updated from the hash... |
So, we basically have 4 options here:
Let me know which one you'd prefer. IMO shipping the script would be the easiest path. @d8ahazard |
Ship the script for people who want to do research. Also, if needed, we can add DPM-karras sampler along with existing DPM sampler. Maybe a setting for user to show which samplers are shown in UI. |
@AUTOMATIC1111 please review and pull |
Although the sigma range 0.1 - 10 works, I would note it's purely a 'what looked best' choice by myself, for contrast and detail, the k-diffusion configs routinely uses the range 0.01-80: https://github.com/crowsonkb/k-diffusion/blob/f4e99857772fc3a126ba886aadf795a332774878/configs/config_cifar10.json#L17 (albeit for different models) but those values are just noise for me with DPM Adaptive-SD: |
@dfaker Birch-san uses 0.2 to 14, I think. Ultimately though 0.1 - 10 produces good results and if I had added knobs to control the sigma range, it would be basically a reimplementation of your script at that point. There are some other things that can be done (early ramp finish for example) but IIRC crowsonkb plans to implement those so I decided to wait for official support rather than hacking together a monstrosity. |
Cool, just wanted to make sure no one is mistaking my arbitrary choices for reasoned defaults! |
@dfaker BTW, if you want to experiment with sigma ranges, don't use DPM fast or adaptive as (at least my implementation) is compatible only with SD scheduler. |
Actually, we could also use the same range SD scheduler uses. Subjectively, 0.1 to 10 looks better, but using the same vanilla range is a more direct migration and still achieves the main motivation of this PR (removing noise). Using the vanilla range (which is actually 0.03/14.6), the same seed produces this image: @AUTOMATIC1111 What do you think? |
It's noise because it's not valid to use a noise level outside of the range that Stable Diffusion was trained on. You have to pull the sigma_min and sigma_max out of the SD model wrapper. sigma_min, sigma_max = model_wrap.sigmas[0].item(), model_wrap.sigmas[-1].item() Around these lines. |
This PR updates K-Diffusion to enable the newest improvements in DPM Adaptive (stochastic sampling and ancestral sampling for adaptive) and includes the noise scheduler script by @dfaker.
The reason I include the script can be seen here #1435 but the TLDR is DPM samplers will output a unpleasantly noisy/filtered image if using the default scheduler. Karras scheduling seems to be the intended way to use these samplers. I included the script instead of changing the default to preserve seed compatibility.
closes #1435
Default
Karras scheduling