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.
This commit is contained in:
parent
50abf7c938
commit
2d880fec3a
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…
Reference in New Issue