the common sampler code has:
if disable_noise:
noise = torch.zeros(latent_image.size(), dtype=latent_image.dtype, layout=latent_image.layout, device="cpu")
else:
batch_inds = latent["batch_index"] if "batch_index" in latent else None
noise = comfy.sample.prepare_noise(latent_image, seed, batch_inds)
prepare_noise is what sets the global RNG that various thing such as ancestral samplers use, so when add_noise is disabled this means no seed gets set before sampling and the RNG is an undefined state. in other words, if you turn off add_noise and use a sampler like euler_a it's impossible to reproduce generations.
it's easy to reproduce: just use an advanced or custom sampler, set a fixed seed, turn off add_noise and use euler_a. start generating and look at the preview. abort it at 50% or so and restart, you will get a completely new generation each time.
is there any reason not to just do torch.manual_seed(seed) in the disable_noise code path to ensure the RNG is in a defined state based on the seed the user set?
i made a simple work around ( https://github.com/blepping/ComfyUI-bleh#blehforceseedsampler ) but it would be nice if that wasn't necessary. edit: my workaround doesn't seem to work reliably
see below for a visual demonstration of the issue. ignore the "Noisy Latent Image" node, it's not connected to anything. the seed comes from a Seed Everywhere node near the top right (set to 0)
current behavior


the common sampler code has:
prepare_noiseis what sets the global RNG that various thing such as ancestral samplers use, so whenadd_noiseis disabled this means no seed gets set before sampling and the RNG is an undefined state. in other words, if you turn offadd_noiseand use a sampler likeeuler_ait's impossible to reproduce generations.it's easy to reproduce: just use an advanced or custom sampler, set a fixed seed, turn off
add_noiseand useeuler_a. start generating and look at the preview. abort it at 50% or so and restart, you will get a completely new generation each time.is there any reason not to just do
torch.manual_seed(seed)in thedisable_noisecode path to ensure the RNG is in a defined state based on the seed the user set?i made a simple work around ( https://github.com/blepping/ComfyUI-bleh#blehforceseedsampler ) but it would be nice if that wasn't necessary.edit: my workaround doesn't seem to work reliablysee below for a visual demonstration of the issue. ignore the "Noisy Latent Image" node, it's not connected to anything. the seed comes from a
Seed Everywherenode near the top right (set to 0)current behavior
with #2841