Are you ready to unlock the power of artificial intelligence using Stable Diffusion on your AMD Radeon GPU? This guide will walk you through the steps necessary to set up and run the AUTOMATIC1111 fork of Stable Diffusion WebUI using Docker. With the right setup, you’ll be generating images from text in no time!
Requirements
Before diving in, make sure you have the following:
- A compatible Radeon GPU (VEGA 5664, Radeon RX 6600XT, 67XX, 68XX, 69XX).
- A modern Linux kernel with ROCm module (Kernel 5.10 or higher).
- Docker installed on your system.
- At least 50GB of drive space for the Docker installation.
Installation Steps
Follow these steps to pull the necessary Docker image and run it:
1. Pull the Docker Image
In your terminal, execute the following command to pull the Stable Diffusion ROCm Docker image:
docker pull l1naforever/stable-diffusion-rocm:latest
2. Create an Alias for Running Docker
Create an alias that will simplify running the Docker container. Add the following line to your ~/.zshrc
or ~/.bashrc
file:
alias drun='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 $(pwd):/pwd'
3. Run the Container
Now, you can run the container with this command:
drun --name stable-diffusion l1naforever/stable-diffusion-rocm:latest
After a bit of time spent downloading models and dependencies, you should see:
Running on local URL: http://localhost:7860
Open this URL in your web browser to access the Stable Diffusion web UI!
Troubleshooting
If you encounter issues, especially with starting the container, here are some solutions:
- Container fails to start with hipErrorNoBinaryForGpu: This error indicates that HIP’s libraries are not loading the correct kernel for your GPU. You can resolve this by setting an environment variable to force HIP to use the gfx1030 kernel. Modify your alias or run the following:
alias drun='docker run -e HSA_OVERRIDE_GFX_VERSION=10.3.0 -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/pwd'
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Understanding the Code
Think of the process of setting up Stable Diffusion with Docker as setting up a stage for a play. Each command is like arranging the stage elements to ensure a smooth performance:
- The
docker pull
is like getting your set pieces (the Docker image) delivered to the theater (your local machine). - The alias setup acts as your director’s cue cards that help the actors (the Docker container) understand their roles and the environment they need to perform in.
- Finally, executing
drun
runs the play with all elements in place, allowing the audience (you) to enjoy the show through the web interface athttp://localhost:7860
.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.