Fix nondeterministic results when add_noise==disable
Images generated by KSampler (Advanced) and SamplerCustom nodes are nondeterministic when add_noise is set to False.
Seems like we need to call torch.manual_seed(seed) before sampling in order to get deterministic results.
You can reproduce this problem by generating multiple times the same image with a fixed seed on ancestral sampler without adding initial noise.
This PR fixes that issue by moving all torch.zeros calls inside prepare_noise function right after setting torch seed.
Related to https://github.com/comfyanonymous/ComfyUI/pull/2841
hope you have better luck than i did!
(Automated Bot Message) CI Tests are running, you can view the results at https://ci.comfy.org/?branch=4518%2Fmerge
how is this bug still a thing after being reported almost a year ago, multiple people submitting pulls trying to fix the problem. still nothing. i don't get it.
it's also a really annoying bug. one of ComfyUI's biggest strengths is being able to iterate and this kills that.
hopefully this is still going to happen.