shiimizu / ComfyUI_smZNodes

Custom nodes for ComfyUI such as CLIP Text Encode++
GNU General Public License v3.0
168 stars 12 forks source link

Negpip support #68

Closed pamparamm closed 1 month ago

pamparamm commented 2 months ago

Should resolve #12 and kinda resolves #28 (incorporates functionality from negpip node but still makes it incompatible)

Based on https://github.com/laksjdjf/cd-tuner_negpip-ComfyUI Makes it possible to use negative weights in prompts. Since patching attn2 is required for negpip to work, it's necessary to hook into default sd1_clip.ClipTokenWeightEncoder.encode_token_weights function.

Without negative weights everything should work exactly the same.

Not sure if the part under opts.prompt_mean_norm is correct (it works for negative weights, but the means for zk and zv are different, could lead to some strange effects)