mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-19 19:03:51 +00:00
Make perp neg take a conditioning input instead of a CLIP one.
This commit is contained in:
parent
574363a8a6
commit
9cad2f06ff
@ -9,7 +9,7 @@ class PerpNeg:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required": {"model": ("MODEL", ),
|
return {"required": {"model": ("MODEL", ),
|
||||||
"clip": ("CLIP", ),
|
"empty_conditioning": ("CONDITIONING", ),
|
||||||
"neg_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 100.0}),
|
"neg_scale": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 100.0}),
|
||||||
}}
|
}}
|
||||||
RETURN_TYPES = ("MODEL",)
|
RETURN_TYPES = ("MODEL",)
|
||||||
@ -17,13 +17,9 @@ class PerpNeg:
|
|||||||
|
|
||||||
CATEGORY = "_for_testing"
|
CATEGORY = "_for_testing"
|
||||||
|
|
||||||
def patch(self, model, clip, neg_scale):
|
def patch(self, model, empty_conditioning, neg_scale):
|
||||||
m = model.clone()
|
m = model.clone()
|
||||||
|
nocond = comfy.sample.convert_cond(empty_conditioning)
|
||||||
tokens = clip.tokenize("")
|
|
||||||
nocond, nocond_pooled = clip.encode_from_tokens(tokens, return_pooled=True)
|
|
||||||
nocond = [[nocond, {"pooled_output": nocond_pooled}]]
|
|
||||||
nocond = comfy.sample.convert_cond(nocond)
|
|
||||||
|
|
||||||
def cfg_function(args):
|
def cfg_function(args):
|
||||||
model = args["model"]
|
model = args["model"]
|
||||||
|
Loading…
Reference in New Issue
Block a user