The instructions below only work on Linux! An alternative guide for Windows user can be found here (untested).
Running natively
Execute the following:
apt update && apt install -y python-is-python3
git clone https://git.tcp.direct/Mirrors/stable-diffusion-webui.git
cd stable-diffusion-webui
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip wheel
pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1
python3 launch.py --precision full --no-half
It's possible that you don't need
--precision full
, dropping--no-half
however crashes my drivers
In following runs you will only need to execute:
cd stable-diffusion-webui
source venv/bin/activate
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1' python3 launch.py --precision full --no-half
The first generation after starting the WebUI might take very long, and you might see a message similar to this:
MIOpen(HIP): Warning [SQLiteBase] Missing system database file: gfx1030_40.kdb Performance may degrade. Please follow instructions to install: https://github.com/ROCmSoftwarePlatform/MIOpen#installing-miopen-kernels-package
The next generations should work with regular performance.
You can follow the link in the message, and if you happen to use the same operating system, follow the steps there to fix this issue.
If there is no clear way to compile or install the MIOpen kernels for your operating system, consider following the Docker guide below.
Running inside Docker
-
Pull the latest rocm/pytorch Docker image
-
Start the image and attach to the container (taken from the rocm/pytorch documentation):
docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $HOME/dockerx:/dockerx rocm/pytorch
Execute the following inside the container:
apt update && apt install -y python-is-python3
cd /dockerx
git clone https://git.tcp.direct/Mirrors/stable-diffusion-webui.git
cd stable-diffusion-webui
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -U pip wheel
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1' REQS_FILE='requirements.txt' python launch.py --precision full --no-half
Following runs will only require you to restart the container, attach to it again and execute the following inside the container:
- Find the container name from this listing:
docker container ls --all
- Select the one matching:
rocm/pytorch
- Restart it:
docker container restart <container-id>
- Attach to it:
docker exec -it <container-id> bash
cd /dockerx/stable-diffusion-webui
source .venv/bin/activate
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1' REQS_FILE='requirements.txt' python launch.py --precision full --no-half
The /dockerx
folder inside the container should be accessible in your home directory under the same name.
Updating Python version inside Docker
If the web UI becomes incompatible with the pre-installed Python 3.7 version inside the Docker image, assuming you have successfully followed "Running inside Docker", Execute the following inside the container:
apt install python3.9-full
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 39
echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
Then restart the container and attach again.
If you check python3 --version it should now say Python 3.9.5 or newer.
Run python3 -m venv dockerx/stable-diffusion-webui/.venv --upgrade
TORCH_COMMAND='pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1' python launch.py --precision full --no-half
Certain cards like the Radeon RX 6000 Series and the RX 500 Series have been will function normally without the option --precision full --no-half, saving plenty of vram.
Always use this new launch-command from now on, also when restarting the web UI in following runs.
This is the Stable Diffusion web UI wiki. Wiki Home