-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
Add custom k_diffusion scheduler #10634
Add custom k_diffusion scheduler #10634
Conversation
imo, if you're doing this, you may want to go ahead and just add every available scheduler in kdiffusion. It was pointed out here that for DPM-Solver++(2M) SDE, exponential is technically better than Karras. |
Actually I also point this out in my issue but I am still struggling on it |
The problem here for "every scheduler" is that not all the scheduler need same parameters If you think ignore vp is ok, I can make it work in 10min |
VP is the default iirc, so that might be fine. |
oh that's good, ok, I will add a dropdown for it |
Actually on doing a sanity check, that isn't true. Default noise scheduler for kdiffusion is found here. VP can be addressed later though, I think what this is mostly trying to solve, exposing Karras and other scheduler parameters, is more important. |
ok, The default noise scheduler is as same as what SD have in their model. |
great work! |
Probably want to rename everywhere where applicable |
oh yes, make sense |
Should only ever be adding the extra params to kdiffusion samplers, and only when the custom kdiffusion scheduler is checked. For example, it currently adds it for DDIM and when the custom scheduler is unchecked. |
Should I just add a check for sampler name so if user choose the non-kdiffusion sampler, p.enable_karras will automatically be False? |
I think it can be safe to assume the custom scheduler is not in use if it's not contained in the metadata. That logic would put in |
oh wait I pushed some not-related code( |
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.
Minor naming fixes
In my UI, enabling it causes it to appear above CFG scale instead of below the checkbox. I assume this isn't intentional since your screenshots show otherwise. This is with only built-in extensions. Also, stable-diffusion-webui/modules/sd_samplers_kdiffusion.py Lines 250 to 253 in 89f9faa
|
@catboxanon for your screen shot, you may want to add "kdiffusion_scheduler" into your ui settings (the order part) And for high rho for polyexponential |
Ah, I overlooked that, thanks! For most users that shouldn't matter then, it only did for me since I had set that manually prior. VP scheduler would still be nice to have, but again, that could wait until a follow-up PR. This otherwise seems to be working with everything else I've tested thus far. |
@catboxanon cool! |
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.
A couple more comments. Title of this PR should be changed too.
I don't believe those belong in the main image generation interface. We have a settings page with settings for other sampler parameters, and if the user wants to have those available to him in main interface, he can use quicksettings. Have them added as settings. |
I would generally agree to that but I think this is a bit more debatable. As mentioned in the issue (#10621) Karras samplers shouldn't even be a separate option in the first place. And this impacts all kdiffusion samplers, not just a minor few like |
At minimum, I would say the scheduler should be selectable in the main interface, and everything else (sigma, rho) could potentially be relegated to settings. |
Here's a simple solution: keep the list as it is, add those overrides as settings, do not deprecate anything. If you really want to remove some entries from the list, you'd also have to write some code to be compatible with infotexts of already generated images. Is it worth it? You can make scheduler selectable in the main interface via quicksettings. |
I think we need a better way to display quicksettings then because it's going to continually get more cluttered as more things are relegated there. Controls like this and CFG rescale don't feel like one-and-done type settings to me. That can be addressed in a separate PR though, so I otherwise am OK with your judgement. |
The problem is, this kind of settings is not something you can set it once and done. Actually in my opinion, if k_diffusion scheduler settings should not in the main interface, CFG scale also should not in the main interface. And for deprecate "karras" sampler, I agree that we can keep the list of it. Or we will need to make some convertion to accept it and automatically fill the sigma_max/sigma_min for them |
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
@KohakuBlueleaf @AUTOMATIC1111 Here, take a look at this. I tried my hand at implementing an option for a second quicksettings area that should be more sufficient for controls like this. #10648 |
@catboxanon it looks good! |
I would open a separate PR incase auto changes his mind, but it seems like putting it in settings is where this is going to end up. |
Makes sense. |
@catboxanon I find a problem here. rho also has this problem, the value range should not be restricted. |
Well stable-diffusion-webui/modules/processing.py Line 147 in 89f9faa
I think |
@catboxanon so something like this? |
LGTM |
@catboxanon Another problem here. How can I let the "send to txt2img/img2img" in image browser to send the sigma_min/sigma_max if they are in settings? edit: I found it |
Describe what this pull request is trying to achieve.
#10621 implement this feature request.
I use it as hires fix, only make the options visible if it is enabled.
I didn't remove the "XXX karras" sampler since user may not know what is the sigma_max/sigma_min/rho for them.
This custom scheduler can be used on all the k_diffusion sampler
Additional notes and description of your changes
I add some new arguments for txt2img and img2img, I don't know if I should use this way or another api/hook.
Environment this was tested in
List the environment you have developed / tested this on. As per the contributing page, changes should be able to work on Windows out of the box.
Screenshots or videos of your changes