Skip to content

szhublox/experimental-behaviors-sdwebui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 

Repository files navigation

Add ways to modify image generation procedure

  • Change kdiffusion denoise method
  • Disable mean restore procedure at the end of process_tokens()
  • Generate initial latent on CPU instead of GPU
  • Swap prompt/negative prompt and negate CFG
  • Set sampler stop_at
  • Modify CLIP position_ids inline

Notes

Changing kdiffusion denoise

There are two options, "Reverse" and "Dual" with an accompanying slider to determine how far into generation to swap to the alternate method. Set to 0 does nothing, and set to 0.2 will set the change for the last 20% of generation. The CompVis samplers are DDIM, PLMS, and UniPC, and kdiffusion is everything else.

The reverse method simply changes what gets denoised after sampling - cond instead of uncond. This leads to cleaner but less creative images.

The dual method does the standard method, and the reverse method, and averages them.

Disabling mean restoration

There is a comment in sd_hijack_clip.py: "# restoring original mean is likely not correct, but it seems to work well to prevent artifacts that happen otherwise". This has an effect on (weighted tokens:1.2).

This checkbox removes the last two lines from that function:

new_mean = z.mean()
z = z * (original_mean / new_mean)

Generating initial latent on CPU

Generating on GPU gives different results on different cards, but generating on CPU does not. This is also available as a setting in new versions of webui.

Swap prompt/negative prompt and negate CFG

This does not change the image output very much, but sometimes it is better. An interesting side-effect is the ability to use AND in the negative prompt, regardless of whether or not that's a good idea. This alters the final infotext to appear normal so that the PNG Info tab will mostly give back what you originally typed.

Setting sampler stop_at

Force the sampler to stop too early. For example, if the slider is set to 4 while generating 28 steps, only the first 24 steps will be taken. Sometimes this is an improvement, especially depending on which checkpoint is loaded. This uses the same trick as the reverse denoise option, so using this with a CompVis sampler will not work well.

Modifying CLIP position_ids

Normally this should be a list of numbers from 0-76, but due to model merging, sometimes they become off by a little bit. This option allows to set them correctly, or to set them very wrong on purpose. This does not change the model on disk, only temporarily in memory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages