Docker must be installed and working.
In shell:
docker pull rocm/pytorch:rocm5.2_ubuntu20.04_py3.7_pytorch_1.11.0_navi21
docker run -it --name stable-diffusion-webui --network=host --device=/dev/kfd --device=/dev/dri \
--group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-v $HOME/dev/stable-diffusion-docker:/dockerx rocm/pytorch:rocm5.2_ubuntu20.04_py3.7_pytorch_1.11.0_navi21
Alternatively, replace --network=host
with a different network if you don't want the container sharing the host's interface.
In the container:
# Upgrade Python
apt install python3.9-full # Confirm every prompt
update-alternatives --install /usr/local/bin/python python /usr/bin/python3.9 1
echo 'PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Install Stable Diffusion
cd /dockerx
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
python -m pip install --upgrade pip wheel
# First run
HSA_OVERRIDE_GFX_VERSION=10.3.0 REQS_FILE='requirements.txt' python launch.py \
--precision full --no-half --skip-torch-cuda-test
Add --listen
to make it available to other machines on the same network.
Test: http://127.0.0.1:7860
If it works, make it easier to run next time. Create container file /dockerx/start-ui
with:
#!/bin/bash
cd /dockerx/stable-diffusion-webui
HSA_OVERRIDE_GFX_VERSION=10.3.0 REQS_FILE='requirements.txt' python launch.py \
--precision full --no-half --skip-torch-cuda-test
Make it executable.
chmod +x /dockerx/start-ui
Later, after exiting container, from shell:
docker container restart stable-diffusion-webui
docker exec -it stable-diffusion-webui bash
/dockerx/start-ui