Browse Source

Add a node to zero out the cond to advanced/conditioning

The stability streamlit example passes a zero cond as the negative input
so using this for the negative input makes outputs match the streamlit.
pull/809/head
comfyanonymous 1 year ago
parent
commit
2d880fec3a
  1. 21
      nodes.py

21
nodes.py

@ -148,6 +148,25 @@ class ConditioningSetMask:
c.append(n)
return (c, )
class ConditioningZeroOut:
@classmethod
def INPUT_TYPES(s):
return {"required": {"conditioning": ("CONDITIONING", )}}
RETURN_TYPES = ("CONDITIONING",)
FUNCTION = "zero_out"
CATEGORY = "advanced/conditioning"
def zero_out(self, conditioning):
c = []
for t in conditioning:
d = t[1].copy()
if "pooled_output" in d:
d["pooled_output"] = torch.zeros_like(d["pooled_output"])
n = [torch.zeros_like(t[0]), d]
c.append(n)
return (c, )
class VAEDecode:
@classmethod
def INPUT_TYPES(s):
@ -1350,6 +1369,8 @@ NODE_CLASS_MAPPINGS = {
"LoadLatent": LoadLatent,
"SaveLatent": SaveLatent,
"ConditioningZeroOut": ConditioningZeroOut,
}
NODE_DISPLAY_NAME_MAPPINGS = {

Loading…
Cancel
Save