-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nondeterministic results when add_noise==disable #4518
base: master
Are you sure you want to change the base?
Conversation
Related to #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. |
Images generated by
KSampler (Advanced)
andSamplerCustom
nodes are nondeterministic whenadd_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 insideprepare_noise
function right after setting torch seed.