stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

LMS Karras introduces strange artifacts looking like a mess of colors

Open Starcatcher2009 opened this issue 2 years ago • 18 comments

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 avatar Oct 16 '22 13:10 Starcatcher2009

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

Starcatcher2009 avatar Oct 16 '22 13:10 Starcatcher2009

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

kalkal11 avatar Oct 16 '22 13:10 kalkal11

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 avatar Oct 16 '22 14:10 Starcatcher2009

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 avatar Oct 16 '22 14:10 Starcatcher2009

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

Starcatcher2009 avatar Oct 16 '22 14:10 Starcatcher2009

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

kalkal11 avatar Oct 16 '22 14:10 kalkal11

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.

khanonnie avatar Oct 17 '22 01:10 khanonnie

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

Starcatcher2009 avatar Oct 17 '22 04:10 Starcatcher2009

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

lockmatrix avatar Oct 17 '22 05:10 lockmatrix

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

Starcatcher2009 avatar Oct 17 '22 07:10 Starcatcher2009

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 avatar Oct 17 '22 10:10 Starcatcher2009

And does smaller resolutions results in worse pictures?

Starcatcher2009 avatar Oct 17 '22 14:10 Starcatcher2009

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

Chryseus avatar Oct 19 '22 10:10 Chryseus

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?

Starcatcher2009 avatar Oct 19 '22 10:10 Starcatcher2009

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 avatar Oct 19 '22 10:10 Chryseus

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

Chryseus avatar Oct 19 '22 11:10 Chryseus

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

jmp909 avatar Oct 24 '22 02:10 jmp909

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.

https://user-images.githubusercontent.com/10369118/198205847-4f6da6d4-daf7-49b3-a2e8-b617de1b3803.mp4

ryakr avatar Oct 27 '22 06:10 ryakr

InvokeAI had the same problem, and they fixed it here: https://github.com/invoke-ai/InvokeAI/pull/1086

MadMinstrel avatar Dec 04 '22 13:12 MadMinstrel

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

TheOnlyHolyMoly avatar Jun 25 '23 17:06 TheOnlyHolyMoly

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.

vladmandic avatar Jun 25 '23 17:06 vladmandic

yes, have seen that looks really charming.

TheOnlyHolyMoly avatar Jun 25 '23 18:06 TheOnlyHolyMoly

Duplicate of #1973

catboxanon avatar Aug 05 '23 02:08 catboxanon

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

ani917 avatar Jun 29 '24 11:06 ani917