comfyanonymous / ComfyUI

The most powerful and modular stable diffusion GUI, api and backend with a graph/nodes interface.
GNU General Public License v3.0
41.25k stars 4.39k forks source link

ComfyUI is not deterministic #375

Open asd417 opened 1 year ago

asd417 commented 1 year ago
ComfyUI_00180_ ComfyUI_00182_ ComfyUI_00183_

All these images are generated with exact same seed and node structure. I believe that the images above maintain their exif data but here is the node structure: Capture You can see that the two seed inputs are linked together. the ui does not even let me generate this twice in a row because it's the same prompt. I think it's a bit of a problem for this to be not deterministic. Will this issue be fixed?

comfyanonymous commented 1 year ago

Yeah that's an issue I need to fix.

wyrde commented 1 year ago

didja fix it?

jexom commented 1 year ago

It's an xformers problem. Xformers optimizations make the generations undeterministic, hence why I stopped using it in auto webui long ago. Haven't looked into it but there should be a way to disable xformers if there's none.

ill13 commented 6 months ago

To [mostly] address this issue, one can run ComfyUI with

python main.py --use-pytorch-cross-attention

This should disable Xformers and allow for repeatiblity across generations

catboxanon commented 6 months ago

xformers is deterministic as of 0.0.19. https://github.com/facebookresearch/xformers/releases/tag/v0.0.19

ill13 commented 6 months ago

Good to know! Maybe I'm complelety offbase with the Xformers stuff?

Either way, until I used the above command all of my generations with ComfyUI were unrepeatable and random - directly after starting ComfyUI with --use-pytorch-cross-attention changing seeds back and forth generated what looks to be the same image.