1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 23:14:49 +08:00

Fix SAG not working with cfg 1.0

This commit is contained in:
comfyanonymous
2023-12-18 17:03:32 -05:00
parent 8cf1daa108
commit 571ea8cdcc
3 changed files with 8 additions and 4 deletions

View File

@@ -151,7 +151,7 @@ class SelfAttentionGuidance:
(sag, _) = comfy.samplers.calc_cond_uncond_batch(model, uncond, None, degraded_noised, sigma, model_options)
return cfg_result + (degraded - sag) * sag_scale
m.set_model_sampler_post_cfg_function(post_cfg_function)
m.set_model_sampler_post_cfg_function(post_cfg_function, disable_cfg1_optimization=True)
# from diffusers:
# unet.mid_block.attentions[0].transformer_blocks[0].attn1.patch