- Clone and switch to the stable-diffusion-webui folder
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
- Create a new python environment and switch to it
python -m venv venv
source venv/bin/activate
- Update pip and wheel
python -m pip install --upgrade pip wheel
- To prevent a memory leak in the application, we need to preload
/usr/lib/libtcmalloc.so
, this is part of thegperftools
package. So let's install that:
sudo pacman -S gperftools
- Create and edit a new shell file which we will use to start stable-diffusion-webui
touch start.sh
nano start.sh
- Add this content to the file and save it with
CTRL+O
and exit withCTRL+X
#!/usr/bin/env bash
source venv/bin/activate
export HSA_OVERRIDE_GFX_VERSION=10.3.0
export MIOPEN_DEBUG_COMGR_HIP_PCH_ENFORCE=0
export PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.9,max_split_size_mb:512
export PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.9,max_split_size_mb:512
export TORCH_COMMAND='pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm5.7'
export REQS_FILE='requirements.txt'
export LD_PRELOAD=/usr/lib/libtcmalloc.so
python launch.py --precision full --no-half --enable-insecure-extension-access --listen --opt-sub-quad-attention --no-half-vae --disable-nan-check --medvram
- Make the file executable
chmod +x start.sh
- Deactivate the python environment
deactivate
Switch to the stable-diffusion-webui folder and run:
./start.sh
This seems to be an issue with stable-diffusion-web itself. It also happens with their own runner. For some reason, after trying several times, it eventually worked. No idea what exactly is causing it.