r/StableDiffusion • • Oct 17 '22

Discussion 4090 Performance with Stable Diffusion (AUTOMATIC1111)

Having issues with this, having done a reinstall of Automatic's branch I was only getting between 4-5it/s using the base settings (Euler a, 20 Steps, 512x512) on a Batch of 5, about a third of what a 3080Ti can reach with --xformers.

After searching around for a bit I heard that the default PyTorch being installed by the Repo doesn't support the architecture and you can exchange the line in launch.py on a new install: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/2107

torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113")

with

torch_command = os.environ.get('TORCH_COMMAND', "pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu116")

which will install a newer (the newest?) version of PyTorch. With this I got about 11it/s, installing --xformers seems to have worked too and increased it to about 12it/s, which is about on par with a 3080 and 2it/s short of a 3090/3080Ti with the --xformers improvements.

I also saw some talk about this here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/2537

There's more info and talking about it here too, will go over it later: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2449

Anyone got any more insights or experiences with trying to get it to work on a 4090 or things to try/do to improve the performance, or do we just have to wait for new versions of PyTorch?

21 Upvotes

11 comments sorted by

View all comments

Show parent comment

2

u/IE_5 Dec 16 '22

"As for new version of torch this needs some testing. Plus just changing this line won't install anything except for new users."

Yes, you need to either do this on a new installation (from the beginning) or deinstall the old version and install the new one, just changing the lines on an existing installation won't do anything. More importantly, check the other link thread about CuDNN, that's the critical step.

1

u/sun-tracker Dec 19 '22

Ok yeah, makes sense. The performance increase is massive!