stack is now partial execution safe

This commit is contained in:
mcDandy
2026-02-10 17:08:06 +01:00
parent 4bdbdd7bde
commit 5f6f648636
13 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ class AudioMathNode(io.ComfyNode):
tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, dict) and "waveform" in v]
if not tensor_keys:
raise ValueError("At least one audio input is required.")
stack = stack.deepcopy() if stack is not None else {}
waveforms = {k: V[k]["waveform"] for k in tensor_keys}
sample_rates = {k + "sr": V[k].get("sample_rate", 44100) for k in tensor_keys}
+1
View File
@@ -75,6 +75,7 @@ class CLIPMathNode(io.ComfyNode):
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference CLIP
a = V.get("V0")
stack = stack.deepcopy() if stack is not None else {}
if a is None:
for m in V.values():
if m is not None:
+1
View File
@@ -90,6 +90,7 @@ class ConditioningMathNode(io.ComfyNode):
tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, list) and len(v) > 0]
if not tensor_keys:
raise ValueError("At least one input is required.")
stack = stack.deepcopy() if stack is not None else {}
# Extract tensors and pooled outputs
tensors = {}
+1
View File
@@ -84,6 +84,7 @@ class FloatMathNode(io.ComfyNode):
variables["x"] = V.get("V5", 0.0)
variables["y"] = V.get("V6", 0.0)
variables["z"] = V.get("V7", 0.0)
stack = stack.deepcopy() if stack is not None else {}
# Populate all V inputs
for k, val in V.items():
+1
View File
@@ -83,6 +83,7 @@ class GuiderMathNode(io.ComfyNode):
@classmethod
def execute(cls, V, F, Expression,Expression1,stack={}):
stack = stack.deepcopy() if stack is not None else {}
return (MathGuider(V, F, Expression,Expression1),stack)
+1
View File
@@ -86,6 +86,7 @@ class ImageMathNode(io.ComfyNode):
raise ValueError("At least one input is required.")
tensors = [V[k] for k in tensor_keys]
stack = stack.deepcopy() if stack is not None else {}
# Normalize all tensors together to find the common target shape
normalized_tensors = normalize_to_common_shape(*tensors, mode=length_mismatch)
+1
View File
@@ -100,6 +100,7 @@ class LatentMathNode(io.ComfyNode):
if ref_latent is None:
raise ValueError("At least one input is required.")
stack = stack.deepcopy() if stack is not None else {}
# Identify if any input is a NestedTensor and track original sizes for restoration
stacked = False
+1 -1
View File
@@ -85,7 +85,7 @@ class MaskMathNode(io.ComfyNode):
raise ValueError("At least one input is required.")
tensors = [V[k] for k in tensor_keys]
stack = stack.deepcopy() if stack is not None else {}
# Normalize all tensors together
normalized_tensors = normalize_to_common_shape(*tensors, mode=length_mismatch)
V_norm = dict(zip(tensor_keys, normalized_tensors))
+2
View File
@@ -76,6 +76,8 @@ class ModelMathNode(io.ComfyNode):
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference model for cloning
a = V.get("V0")
stack = stack.deepcopy() if stack is not None else {}
if a is None:
# Try finding first valid model
for m in V.values():
+1
View File
@@ -74,6 +74,7 @@ class NoiseMathNode(io.ComfyNode):
@classmethod
def execute(cls, Noise, V,F,stack={}):
stack = stack.deepcopy() if stack is not None else {}
return (NoiseExecutor(V,F, Noise,stack),)
+1 -1
View File
@@ -87,7 +87,7 @@ class SigmasMathNode(io.ComfyNode):
if ref_image is None:
raise ValueError("At least one input is required.")
stack = stack.deepcopy() if stack is not None else {}
a = V.get("V0")
b = V.get("V1")
c = V.get("V2")
+1
View File
@@ -83,6 +83,7 @@ class VAEMathNode(io.ComfyNode):
break
if a is None:
raise ValueError("At least one input VAE is required.")
stack = stack.deepcopy() if stack is not None else {}
# Prepare VAE patchers for calculation
+1
View File
@@ -95,6 +95,7 @@ class VideoMathNode(io.ComfyNode):
# Use first normalized tensor to establish the reference shape
ref_tensor = normalized_tensors[0]
common_shape = ref_tensor.shape
stack = stack.deepcopy() if stack is not None else {}
# Setup legacy variables a, b, c, d
ae = V_norm.get("V0", make_zero_like(ref_tensor))