Skip to content
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

LMS Karras introduces strange artifacts looking like a mess of colors #2856

Closed
Starcatcher2009 opened this issue Oct 16, 2022 · 24 comments
Closed
Labels
bug-report Report of a bug, yet to be confirmed upstream Issue or feature that must be resolved upstream

Comments

@Starcatcher2009
Copy link

28 steps, 2 last layer/clip ignore thingy, cfg 11, seed -1. Uses Intel (R) Iris (R) iGPU. I cannot describe further since the image is nsfw, however I may privately send you.

@Starcatcher2009 Starcatcher2009 added the bug-report Report of a bug, yet to be confirmed label Oct 16, 2022
@Starcatcher2009
Copy link
Author

Which is a shame since it seems like k_lms is so much better than Euler/Euler a

@kalkal11
Copy link

Not all samplers work well with low steps, having said that, it seems to be fine for me with these settings which is as far as we can test with the given information without the prompt

@Starcatcher2009
Copy link
Author

i don't think 28 is low
plus it seems like LMS Karras (or k_lms, don't know if that's similar) is the default used in NovelAI along with 28 steps

@Starcatcher2009
Copy link
Author

Not all samplers work well with low steps, having said that, it seems to be fine for me with these settings which is as far as we can test with the given information without the prompt

Also would you like to check my nsfw picture along with the prompt?

@Starcatcher2009
Copy link
Author

Or it may be that the AI suddenly decides to be concerningly creative and decides to spit out random blocks of colors, but that's unlikely

@kalkal11
Copy link

Not all samplers work well with low steps, having said that, it seems to be fine for me with these settings which is as far as we can test with the given information without the prompt

Also would you like to check my nsfw picture along with the prompt?

Not really but if it's really an issue, you should be able to produce an alternative sample/samples

@khanonnie
Copy link
Contributor

k_lms and its variants are prone to these types of blocky/mosaic-like artifacts when steps are too low for the selected CFG scale setting. Not a bug, k_lms just requires higher step counts than the other samplers when CFG is higher than ~9.

@Starcatcher2009
Copy link
Author

k_lms and its variants are prone to these types of blocky/mosaic-like artifacts when steps are too low for the selected CFG scale setting. Not a bug, k_lms just requires higher step counts than the other samplers when CFG is higher than ~9.

It also seems like running CPU-only makes the steps less refined, and so might require possibly even more steps. So I might take it to like 40-50+ steps

@lockmatrix
Copy link

k_lms and its variants are prone to these types of blocky/mosaic-like artifacts when steps are too low for the selected CFG scale setting. Not a bug, k_lms just requires higher step counts than the other samplers when CFG is higher than ~9.

Maybe should add a hint contain these info to the sampler on ui

@Starcatcher2009
Copy link
Author

Also where's the "disable vae2.pt" in settings? Like, which category?

@Starcatcher2009
Copy link
Author

Also, is it just me or each time I write something anal in the prompt it usually shows up 2 of them? A big one and a much smaller one near the vagina.

@Starcatcher2009
Copy link
Author

And does smaller resolutions results in worse pictures?

@Chryseus
Copy link

k_lms and its variants are prone to these types of blocky/mosaic-like artifacts when steps are too low for the selected CFG scale setting. Not a bug, k_lms just requires higher step counts than the other samplers when CFG is higher than ~9.

That doesn't appear to be the case, it's getting worse as the steps go up, something is wrong with k_lms, I never had this issue a few weeks back.

50 steps
image
100 steps
image
150 steps
image

Prompt: star trek enterprise ship, 4k, highly detailed, space
Negative: text. not in frame, blurry, bad geometry, ugly
CFG Scale: 14
Seed: 2297975078
Resolution: 512x512

@Starcatcher2009
Copy link
Author

k_lms and its variants are prone to these types of blocky/mosaic-like artifacts when steps are too low for the selected CFG scale setting. Not a bug, k_lms just requires higher step counts than the other samplers when CFG is higher than ~9.

That doesn't appear to be the case, it's getting worse as the steps go up, something is wrong with k_lms, I never had this issue a few weeks back.

50 steps image 100 steps image 150 steps image

Prompt: star trek enterprise ship, 4k, highly detailed, space Negative: text. not in frame, blurry, bad geometry, ugly CFG Scale: 14 Seed: 2297975078 Resolution: 512x512

At which point the picture becomes best? Or is it actually in reverse and is most beautiful at 1 step?

@Chryseus
Copy link

At which point the picture becomes best? Or is it actually in reverse and is most beautiful at 1 step?

Somewhere between 20-30 steps looks best, it really starts to be noticeable above 40 steps, if I have it show previews however it looks fine as it progresses even with 150 steps, it only becomes corrupt when making the final image.
I've used 100+ steps in the past without this issue appearing.

@Chryseus
Copy link

Chryseus commented Oct 19, 2022

I found the issue, running it with --no-half appears to solve the problem which is a bit weird as the other samplers seem to work fine without it.
I'm now using --medvram --no-half

@jmp909
Copy link

jmp909 commented Oct 24, 2022

i noticed if you set eg Show image creation progress every N sampling steps to 5 and watch it build up it looks fine, but on saving the image gets corrupted

used 100 steps here, and preview every 5

last few steps:
image

final output saved to disk:
00673-LMS Karras-steps100-cfg7-seed1479021031-20221024034911

@ryakr
Copy link

ryakr commented Oct 27, 2022

Issue is still occurring, even on high end cards with --no-half. My 3090 just cooks it throughout the whole process on LMS which is very strange. Im using the settings I have always used and found to work on my model but now it explodes on even a clean install of auto. You can see it just dying in the preview generation. Multiple users in the Furry Diffusion discord have also reported this issue.

Steps 70, cfg 10, normal LMS/ LMS Karras both encounter same issue.

XLfcFIGpFM.mp4

@MadMinstrel
Copy link

InvokeAI had the same problem, and they fixed it here: invoke-ai/InvokeAI#1086

@TheOnlyHolyMoly
Copy link

@vladmandic not top of the list, but are you aware of this issue and the solution?

@vladmandic
Copy link
Collaborator

I wasn't aware.
Fix seems trivial, but only if done upstream in k_diffusors. Doing it downstream is really messy and I don't want to create a kdiffusion fork that I'd have to maintain.

I have another proposal right now that I need to followup on - to make Karras in general a checkbox and remove Karras schedulers in general as in theory any scheduler can work in Karras and standard mode.

@TheOnlyHolyMoly
Copy link

yes, have seen that looks really charming.

@catboxanon
Copy link
Collaborator

catboxanon commented Aug 5, 2023

Duplicate of #1973

@catboxanon catboxanon marked this as a duplicate of #2856 Aug 5, 2023
@catboxanon catboxanon marked this as a duplicate of #1973 Aug 5, 2023
@catboxanon catboxanon added the upstream Issue or feature that must be resolved upstream label Aug 5, 2023
@ani917
Copy link

ani917 commented Jun 29, 2024

I found that the problem is that the image always has color artifacts, but when using LMS it becomes 35 times more noticeable

Atry pushed a commit to Atry/stable-diffusion-webui that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed upstream Issue or feature that must be resolved upstream
Projects
None yet
Development

No branches or pull requests