Installing Automatic1111 on Linux
How to install the Automatic1111 Stable Diffusion Webui and start generating images! This guide assumes you have an Nvidia GPU and Linux. We have a 4090 AI discord community, if you're lucky enough to have one, come say hi! https://discord.gg/zVAvFp3wnU
If you're on Windows, @GuruVirus wrote a great guide for you here: https://rentry.org/31337
This guide has been streamlined significantly since I started it, as advances in tech have made it easier to get a1111 up and running! Great stuff.
I'm going to give instructions for Ubuntu's apt, if you use a different package manager please adjust accordingly.
Dependencies
Do you have python 3.10.6 or higher installed?
If not, maybe it's time to upgrade to the latest version of your Linux distro. You need to install Nvidia drivers, git and some python packages:
Replacing "530" with whatever the latest version is. For Windows, download and install from here: https://www.nvidia.co.uk/Download/index.aspx. Also install git from here: https://git-scm.com/download/win.
Install CUDA 12.1 by following these instructions: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
Then reboot.
Installing Automatic1111's WebUI
Let's pull down the latest version of the webui:
Let's aim to move our data out of the repo so that we can reinstall easily in future. We'll use a symlink, to make sure we don't get any permission errors with extensions:
We need to enter the webui's virtual environment and find out the latest version of torch 2 with CUDA support.
It will output a list of available versions. We want to install the latest one:
Also, we need to install xformers:
Edit the webui-user.sh
file and add "--xformers --data-dir data" to COMMANDLINE_ARGS
.
Then run the webui:
It should install some stuff. It will download the SD v1.5 ema only model (to ~/stable-diffusion-data/models/) for you to get started.
Test Your Speed
Use the 1200 Test to measure your speed:
- Hit generate (the first generation is slower, so get it out of the way)
- Ensure you're using model SD v1.5 ema only (https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors).
- Use sampler Euler A and width/height 512x512.
- 150 steps.
- Batch size 8 (not batch count!).
- Prompt "cat in the hat".
- Hit generate!
- Look in the console and calculate
1200 ÷ <the number of seconds it took>
to get your it/s.
4090 Grotto
You should be getting at least 40 it/s on a 4090.
Join us at the 4090 Grotto on discord and tell us your 1200 test results! https://discord.gg/zVAvFp3wnU
You'll find resources and support from a friendly community of 4090 owners.
Have fun! -Mad
Maintenance
Whenever you mess about with pip packages, make sure you're in the webui's venv. The venv is a python virtual environment that the webui uses to keep any changes to python packages local to the webui.
All python packages will be installed within the venv folder. This means that as long as you backup your webui folder, if you make any changes that mess things up then all you need to do is revert to the backup to get back to a working system.
Mistakes
Are there any mistakes in this guide, or improvements you can suggest? Let me know on discord, https://discord.gg/zVAvFp3wnU
-Mad