From acba2c9bddb828b19b217ecd32d3aef6c9ac15c6 Mon Sep 17 00:00:00 2001 From: mcDandy Date: Sun, 18 Oct 2026 12:54:00 +0200 Subject: [PATCH] Pass input noise seed through noise math Co-Authored-By: Claude Opus 5.5 --- more_math/NoiseMathNode.py | 4 ++-- more_math/deprecated/NoiseMathNode.py | 3 +-- tests/test_more_math.py | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/more_math/NoiseMathNode.py b/more_math/NoiseMathNode.py index 3d7d94a..ba753fe 100644 --- a/more_math/NoiseMathNode.py +++ b/more_math/NoiseMathNode.py @@ -73,8 +73,8 @@ class NoiseExecutor: else: self.tree = expr self.stack = stack - - seed = -1 + # Samplers seed their own noise (ancestral/SDE) from noise.seed, so pass the first input's seed through + self.seed = next((v.seed for v in V.values() if v is not None), 0) def generate_noise(self, input_latent: torch.Tensor) -> torch.Tensor: samples = input_latent["samples"] diff --git a/more_math/deprecated/NoiseMathNode.py b/more_math/deprecated/NoiseMathNode.py index 935ddc3..ddf674d 100644 --- a/more_math/deprecated/NoiseMathNode.py +++ b/more_math/deprecated/NoiseMathNode.py @@ -100,8 +100,7 @@ class NoiseExecutor: self.z = z self.expr = Noise self.tree = parse_expr(Noise) - - seed = -1 + self.seed = next((n.seed for n in (a, b, c, d) if n is not None), 0) def generate_noise(self, input_latent: torch.Tensor) -> torch.Tensor: samples = input_latent["samples"] diff --git a/tests/test_more_math.py b/tests/test_more_math.py index 3cbfbed..311a51c 100644 --- a/tests/test_more_math.py +++ b/tests/test_more_math.py @@ -360,6 +360,7 @@ def test_noise_math_5d(): class MockNoise: def __init__(self, tensor): self.tensor = tensor + self.seed = 0 def generate_noise(self, input_latent): return self.tensor @@ -382,6 +383,7 @@ def test_noise_math_autogrow(): class MockNoise: def __init__(self, tensor): self.tensor = tensor + self.seed = 0 def generate_noise(self, input_latent): return self.tensor