mcmonkeyprojects / sd-dynamic-thresholding

Dynamic Thresholding (CFG Scale Fix) for Stable Diffusion (eSwarmUI, ComfyUI, and Auto WebUI)
MIT License
1.1k stars 103 forks source link

Bug: dynamic thresholding changes secondary sampler name #65

Open afbagwell opened 1 year ago

afbagwell commented 1 year ago

Brief description: When saving an image in SD.Next, the dynamic thresholding extension is changing the name of the latent sampler in the image's recorded metadata by appending "_dynthresXXX" characters to the end. This is transposed back to latent sampler name field when feeding the image metadata to the Text2Image tab causing it to name a sampler that doesn't exist.

In looking at the code, it appears that when issue #58 was implemented, somehow the thresholding name for the latent sampler is being restored as the latent sampler's original name.

Linking to the bug explanation as originally posted on the SD.Next issues page:

https://github.com/vladmandic/automatic/issues/2124

afbagwell commented 1 year ago

I don't have a fix for this, but I ran a few tests on the code, specifically in dynamic_thresholding.py, lines 163 and 180.

Lines 179-181 correctly restore the names of each sampler, however by that point it appears that the metadata has already been recorded (or copied for later recording) with the altered latent sampler name? It's not clear to me why this same bug doesn't also affect the primary sampler name.