Skip to content

Instantly share code, notes, and snippets.

@NoXPhasma
Last active October 7, 2023 09:44
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NoXPhasma/ba42b615c0ed1cb0c2b3a4a1b359ccf7 to your computer and use it in GitHub Desktop.
Save NoXPhasma/ba42b615c0ed1cb0c2b3a4a1b359ccf7 to your computer and use it in GitHub Desktop.
Install stable-diffusion-webui with ROCm support on Linux

Install stable-diffusion-webui with ROCm support on Arch Linux

First time installation:

  1. Clone and switch to the stable-diffusion-webui folder
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
  1. Create a new python environment and switch to it
python -m venv venv
source venv/bin/activate
  1. Update pip and wheel
python -m pip install --upgrade pip wheel
  1. To prevent a memory leak in the application, we need to preload /usr/lib/libtcmalloc.so, this is part of the gperftools package. So let's install that:
sudo pacman -S gperftools
  1. Create and edit a new shell file which we will use to start stable-diffusion-webui
touch start.sh
nano start.sh
  1. Add this content to the file and save it with CTRL+O and exit with CTRL+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
  1. Make the file executable
chmod +x start.sh
  1. Deactivate the python environment
deactivate

Running stable-diffusion-webui

Switch to the stable-diffusion-webui folder and run:

./start.sh
@EtereosDawn
Copy link

Hello, any idea ?
image

@NoXPhasma
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment