-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
[Bug]: Final Sampling step ruin the image, very visible in DPM2 a #3483
Comments
Could be related to this, I can confirm similar behavior when using outpainting. The step preview images look promising, the final image gets hugely color distorted. No matter what model, sampler or outpainting script is used. |
Could it be that img2img color correction is enabled? Try the same prompts and settings without out to see if that was it. |
You are right. Disabling color correction seems to solve this issue. |
I think this might be a related issue #3465 (regarding color correction) |
I'm having this happen, but with black screen. Not every image. Stopping generation gives me an image. Started happening a few days ago. The regular black output bug does not apply in my case (20 series card, happened last weeks). Happens only on some samplers, all DPM samplers and K_euler_a, but not K_euler. |
DPM2 a and DPM2 a Karras samplers are both affected by an issue described by AUTOMATIC1111#3483 and can be resolved by a workaround suggested by the k-diffusion author at crowsonkb/k-diffusion#43 (comment)
The issue is discussed in k-diffusion @ crowsonkb/k-diffusion#43 I have submitted the workaround recommended there as a PR: #5797 |
DPM2 a and DPM2 a Karras samplers are both affected by an issue described by AUTOMATIC1111#3483 and can be resolved by a workaround suggested by the k-diffusion author at crowsonkb/k-diffusion#43 (comment)
Been frustrated with this for so long - there is a solution! Antiburn Extension in A1111 Extensions Skip x number of last steps and much more https://github.com/klimaleksus/stable-diffusion-webui-anti-burn |
@TheExodus90 oh my god, thank you! |
I left a comment with hints on where this problem may lie in the sister thread for people that have the same issue that isn't the vea or fixed by anti-burn: |
That thread is a bit of a mess, it looks like everyone in there has a different root issue - some have unwanted scale/noise param combos, at least one somehow had a corrupted checkpoint model file? some are seeing changes that came from not-so-specific webui updates, some are just the classic case of "the last step is ugly!! the preview is better!!" but it's just because the preview is soft n blurry while the final image has details (that they happen to not like), you have ... I'll be honest I don't even know what going on as you described your steps to resolve your issue but not what your issue was (demonstration images are essential for diagnosing things like this). This thread was about a bug with DPM2 that was essentially the input noise parameters being janked in such a way as to add a dirty/speckled/noisy effect over an image that wasn't meant to be there (detail-step data was being hyperemphasized). LMS appears to have a similar issue as bosbrand showed, but more specifically corruption that consistently generates blue/cyan distorted noise over top of things. This is likely a fundamental bug in the sampler/noise params as happened with DPM2, but unfortunately iirc last i poked at it, it wasn't so easily resolved as the DPM2 issue was (the issue noticeably varies based on your total step count, and tricks like skipping semifinal step work for some step counts but not others). Honestly with the LMS issue I'm at the point where the best idea of how to deal with it I can suggest is just, ignore it, don't use LMS, use a more stable sampler. DPM++ 2M Karras and UniPC are the current best samplers we have available. SDE is popular if you like randomized results (small changes to input get amplified significantly more than other samplers do, SDE is very similar to the Antiburn is a decent trick to sorta resolve the LMS issue, and also is a powerful tool for the "last step is subjectively ugly" users to get what they subjectively prefer. (DynThres can also help for both of these, particularly in the case where a user wants a large CFG Scale). The DPM2 issue was able to be resolved because
But so, re that other thread, none of the issues in there are going to be properly solvable until they're able to narrow down to very specific sub-issues in the way this thread was able to identify a precise and replicable fault, with exact input data + result images + clear reason as to why the 'bad' output is genuinely worse at a technical level (as opposed to subjectively uglier) + the same output break is seen by other users in the exact same way when they try the same thing + it applies consistently when irrelevant variables are changed (eg seed, prompt, etc should be able to change and still have the issue) If you think you're onto a genuine technical fault that could be resolved, I'd encourage you to gather full details and validation - verify that every detail that shouldn't be relevant can be changed and still replicate the issue and all - and post a new issue thread that includes full issue-demonstrating details and enables others to replicate the issue, at which point we can see about genuinely solving it. (note: avoid reusing existing threads as there are so many "similar sounding" but fundamentally different issues going on in them). ps. apologies for overly long post and apologies if my tone comes across wrong, the purpose of this post is to hopefully help you know how to take your research into that issue and push it towards being something we can actually completely resolve and fix. |
See also #7244, If have provided a reproduction scenario here: #7244 (comment), I will follow up with more investigation bi-secting through git history too see if I can find an introduction point. |
same here |
Duplicate of #1973 Root issue that this issue was opened for was fixed many months ago (#5797). There's a good summary here that explains the remaining issues are very situational, only apply to certain samplers, and/or are not easily solvable. Another use has also commented this issue persists for these samplers in other software (ComfyUI), so it is not something webui specific. It's related to the k-diffusion implementation. If and when it is fixed in k-diffusion, it will be fixed in the webui. tl;dr: Use the |
Is there an existing issue for this?
What happened?
Second to Last Sampling step is better than final result, very visible in DPM2 a and similar sampler Karras,
Changing the amount of steps does not fix it, it is always the second to last sampling the one with good results.
Sad to see underrated [DPM2 a] sampler just because a bug, Here is a comparison from current build 6bd6154
Steps to reproduce the problem
What should have happened?
Perhaps shared.state.sampling_step is not updated and the sample process goes one more step when it shouldn't.
Commit where the problem happens
the good: perhaps there is no good commit yet...
the bad: 7ce7fb0 it ruins last step since Sep 6 2022!
and the ugly: 5766ce2 it defeats "Clip skip: 2" feature since Oct 11 2022
What platforms do you use to access UI ?
Windows
What browsers do you use to access the UI ?
Mozilla Firefox
Command Line Arguments
Additional information, context and logs
This custom script will help you save Sampling steps during testing:
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Scripts#saving-steps-of-the-sampling-process
however, the iteration of steps is not counting from 1, but 0
The other problem is in sd_samplers.py > def store_latent(decoded)
This function access shared.state.sampling_step before its update.
For this reason [Show image creation progress every N sampling steps. Set 0 to disable.] will display step 1 and step 2 regardless of bigger N interval, say 5 or 6.
Perhaps this is the reason for the OP bug.
The text was updated successfully, but these errors were encountered: