attempt to fix lazy inputs
This commit is contained in:
@@ -48,7 +48,7 @@ class AudioMathNode(io.ComfyNode):
|
||||
)
|
||||
@classmethod
|
||||
def check_lazy_status(cls, AudioExpr, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(AudioExpr, a, b, c, d)
|
||||
return comonLazy(AudioExpr, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def execute(cls, a, AudioExpr, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0):
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class CLIPMathNode(io.ComfyNode):
|
||||
tooltip = cleandoc(__doc__)
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Model, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Model, a, b, c, d)
|
||||
return comonLazy(Model, a, b, c, d,w,x,y,z)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, Model, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0) -> io.NodeOutput:
|
||||
|
||||
@@ -26,9 +26,9 @@ class FloatMathNode(io.ComfyNode):
|
||||
"""
|
||||
def __init__(self):
|
||||
pass
|
||||
@classmethod
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Model, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Model, a, b, c, d)
|
||||
return comonLazy(Model, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def define_schema(cls) -> io.Schema:
|
||||
"""
|
||||
|
||||
@@ -53,7 +53,7 @@ class ImageMathNode(io.ComfyNode):
|
||||
)
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Image, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Image, a, b, c, d)
|
||||
return comonLazy(Image, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def execute(scls, Image, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0):
|
||||
b = torch.zeros_like(a) if b is None else b
|
||||
|
||||
@@ -68,7 +68,7 @@ class LatentMathNode(io.ComfyNode):
|
||||
#OUTPUT_TOOLTIPS = ("",) # Tooltips for the output node
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Latent, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Latent, a, b, c, d)
|
||||
return comonLazy(Latent, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def execute(cls, Latent, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0) -> io.NodeOutput:
|
||||
# Extract raw sample tensors (may be Tensor or NestedTensor)
|
||||
|
||||
@@ -36,7 +36,7 @@ class ModelMathNode(io.ComfyNode):
|
||||
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Model, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Model, a, b, c, d)
|
||||
return comonLazy(Model, a, b, c, d,w,x,y,z)
|
||||
|
||||
@classmethod
|
||||
def execute(cls, Model, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0) -> io.NodeOutput:
|
||||
|
||||
@@ -64,7 +64,7 @@ class NoiseMathNode(io.ComfyNode):
|
||||
CATEGORY = "More math"
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Noise, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Noise, a, b, c, d)
|
||||
return comonLazy(Noise, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def execute(cls, Noise, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0):
|
||||
return (NoiseExecutor(a, b, c, d, w, x, y, z, Noise),)
|
||||
|
||||
@@ -33,7 +33,7 @@ class VAEMathNode(io.ComfyNode):
|
||||
tooltip = cleandoc(__doc__)
|
||||
@classmethod
|
||||
def check_lazy_status(cls, Model, a, b=[], c=[], d=[],w=0,x=0,y=0,z=0):
|
||||
return comonLazy(Model, a, b, c, d)
|
||||
return comonLazy(Model, a, b, c, d,w,x,y,z)
|
||||
@classmethod
|
||||
def execute(cls, Model, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0) -> io.NodeOutput:
|
||||
patcher_a = a.patcher
|
||||
|
||||
@@ -40,10 +40,18 @@ class ThrowingErrorListener(ErrorListener):
|
||||
def comonLazy(expr, a, b=None, c=None, d=None, w=0.0, x=0.0, y=0.0, z=0.0):
|
||||
variables = {'a':a,'b':b,'c':c,'d':d,'w':w,'x':x,'y':y,'z':z}
|
||||
need_eval = []
|
||||
print(a,b,c,d,w,x,y,z)
|
||||
input_stream = InputStream(expr)
|
||||
|
||||
lexer = MathExprLexer(input_stream)
|
||||
stream = CommonTokenStream(lexer)
|
||||
stream.fill()
|
||||
print("Tokens:", stream.tokens)
|
||||
for token in filter(lambda t: t.type == MathExprParser.VARIABLE, stream.tokens):
|
||||
if token in variables and variables[token] is None:
|
||||
need_eval.append(token)
|
||||
print("Token:", token.text)
|
||||
print("Variables:", variables)
|
||||
print("Token in variables:", token.text in variables)
|
||||
print("Variable is None:", variables.get(token.text) is None)
|
||||
if token.text in variables and variables[token.text] is None:
|
||||
need_eval.append(token.text)
|
||||
print ("Need eval:", need_eval)
|
||||
Reference in New Issue
Block a user