Stable Diffusion AMD - rocm Debian

Hi, there are several posts about how to install stable diffusion on AMD Cards, but just for Ubuntu and not Debian. Docker can help us there

[need review] Stable Diffusion AMD Debian ROCm

I assume you already have Docker installed

Create Stable Diffusion Folder

ROCm

mkdir SD
cd SD

Clone ROCm via Docker

sudo docker pull rocm/composable_kernel:ck_ub20.04_rocm5.7

Run the Docker container

docker run --name rocm -it -v $HOME/Software/docker/sd --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video rocm/composable_kernel:ck_ub20.04_rocm5.7

Stable Diffusion WebUI and env

Make Sure you replace the paths

Clone from Git

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

Install Python and Python-venv

apt update && apt install python3.11-venv
cd stable-diffusion-webui
python3 -m venv venv
source venv/bin/activate

python3 -m pip install --upgrade pip wheel
export HIP_VISIBLE_DEVICES=0
export PYTORCH_ROCM_ARCH="gfx1100"
export CMAKE_PREFIX_PATH=/Software/docker/sd/stable-diffusion-webui/venv/
pip install -r requirements.txt

pip remove torch torchvision
mkdir repositories
cd repositories
wget https://github.com/pytorch/pytorch/releases/download/v2.1.0/pytorch-v2.1.0.tar.gz
wget https://github.com/pytorch/vision/archive/refs/tags/v0.16.0.tar.gz
tar -xzvf pytorch-v2.1.0.tar.gz && cd pytorch-v2.1.0
pip install cmake ninja
pip install -r requirements.txt
pip install mkl mkl-include
python3 tools/amd_build/build_amd.py


- Does not work from here -


python3 setup.py install
cd ..
tar -xzvf v0.16.0.tar.gz
cd vision-0.15.1
python3 setup.py install
cd /SD/stable-diffusion-webui
python3 launch.py --listen