Skip to content
Alex "mcmonkey" Goodwin edited this page Sep 21, 2023 · 6 revisions

Dynamic Thresholding Extension for Stable Diffusion

How do I use it?

Check info on the Usage-Tips page.

What Does It Do?

What does it do, TLDR

Main point? Let's you set CFG Scale really high and not get that burn effect.

What can it do, in practical terms?

A: Get better results from low step counts.

For example, this image was rendered with only 3 steps:

image

B: Strengthen the output's likelihood of matching your input text

As a random quick example, the first thing I tried typing in while writing this page was a photo of a fat orange cat with bright green eyes sitting on a table next to a lasagna, and here's the output of that with normal SD at CFG Scale 7 vs 15, compared to at the bottom CFG Scale 15 with DT enabled and Mimic 7.

image

This is just the first thing I typed in, not cherrypicked. At scale 7 it doesn't represent all concepts well, at scale 15 it tries to but overburns - it gets saturated and then turns objects into what their oversaturated form looks like (the lasagna turned bright orange which became a bright orange towel instead of lasagna anymore). With Mimic=7 added, it retains the enhanced composition of Scale=15 but is able to undo that oversaturation and restore the lasagna into being lasagna.

C: Use CFGs as high as you like without destroying the image

The same example as above, but now with CFG Scale = 30. Normal SD just destroys the image entirely, but with the right DynThresh settings, it's able to come through clearly.

image

(If you were actually rendering this you would probably want to tweak the settings with a bit more care, maybe enable a scheduler, try to get everything optimized right, but the above was the minimum change needed to demonstrate the "pop art" burn effect being removed.)

Why Should I Use It?

A: You want speed.

Need to render images fast? Configure settings for best quality at low step counts, reduce your step count, and churn out images at speed.

B: You like high CFG Scales

Many SD users have already discovered that raising CFG Scale seems to get better outputs, but they can only go so high before it starts becoming super saturated or "pop art" style. With this extension you can avoid that burn but raise CFG freely.

C: You want quality

Tweaking settings well has the potential to get better quality outputs than you can get without this extension. The detail improvements that are demonstrated above at low step counts, can also be done at high step counts to continue boosting the detail level that you'd already be getting from the higher step count even further.

What is or isn't it compatible with?

  • K-Diffusion samplers (Euler, DPM++, etc): Fully compatible.
  • Original SD samplers (DDIM, PLMS): Not yet compatible.
  • UniPC: compatible, though initial results aren't great.

What does it do, in technical terms?

(TODO)

See also Schedulers.

Mac Users

See this thread here: Mac error help