[GUIDE] Stable Diffusion CPU, CUDA, ROCm with Docker-compose #5049
Replies: 15 comments 18 replies
-
Sorry for the ignorance, but what it is this? I mean, what is its purpose? |
Beta Was this translation helpful? Give feedback.
-
I'm experiencing the same issue. 5700xt/2700x. |
Beta Was this translation helpful? Give feedback.
-
Hi @catzy007 , thanks for the images code. Now when I am trying to reach the api on "http://127.0.0.1:7860/docs" I can't access it. I will be glad if you can post a video of the whole process? |
Beta Was this translation helpful? Give feedback.
-
Minor typo in above. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much, for this work, i thought to give up to try a cpu version an then i found this thread. (Thank you very much for this) |
Beta Was this translation helpful? Give feedback.
-
thanks for the code it works, i tested cpu only. iam new to docker and dockercompose. is there a way to convert docker-compose.yml to simple dockerfile as i use caprover to manage docker and it cant handel docker-compose.yml. so when i try to conver docker-compose.yml to docker file using GPT it doesnt run. help appreciated |
Beta Was this translation helpful? Give feedback.
-
Thanks @catzy007 !!! Finally SD + ROCM working! I tried to update the dependencies from
but I get the error below, i possible to upgrade
|
Beta Was this translation helpful? Give feedback.
-
Used this method to create a CPU runner and it works very well. Only made 2 minor edits to the process. 1: Changed the TORCH_COMMAND in Dockerfile to:
2: Changed the second if statement in the docker-compose.yml starting command to:
|
Beta Was this translation helpful? Give feedback.
-
I'm trying to get this working on Windows11 Pro with WSL2 and everything seemed to be going okay other than during the Nvidia CUDA toolkit and drivers installation where the However I cannot bring the container up:
Maybe I have to reboot - I'm not sure how to get the kernel under WSL2 to restart without rebooting the entire PC and nothing docker, Nvidia, or CUDA related shows up when I type the command I'll try to post an update if I solve this. |
Beta Was this translation helpful? Give feedback.
-
Further update: The command I have to use is
I copied the model file into I will update as things happen (or don't). Update: Same result as before; it doesn't see the Stable Diffusion model in either place. Do I need to put it under |
Beta Was this translation helpful? Give feedback.
-
excellent article. Thank you !!! This is working really fine. One question only: why does it say that the extensions are disabled . This happens if we fo to the extensions tab and try to install from URL. |
Beta Was this translation helpful? Give feedback.
-
hello! @catzy007 PS: |
Beta Was this translation helpful? Give feedback.
-
docker-compose up stablediff-cpu ERROR: for 8951ca12cd43_stablediff-cpu-runner 'ContainerConfig' ERROR: for stablediff-cpu 'ContainerConfig' I have changed the .ckpt to .safetensors after do that run docker compose up command and I'm getting this error |
Beta Was this translation helpful? Give feedback.
-
I have question |
Beta Was this translation helpful? Give feedback.
-
I got a new error it is killing itself after generating image but not even showing on web
|
Beta Was this translation helpful? Give feedback.
-
[UPDATE 28/11/22] I have added support for CPU, CUDA and ROCm. CPU and CUDA is tested and fully working, while ROCm should "work".
Preparing your system
Install docker and docker-compose and make sure docker-compose version 1.72.0 or later is installed.
Then install NVIDIA Container Toolkit or Follow ROCm Docker Quickstart.
For windows, follow CUDA on WSL User Guide then Enabling the Docker Repository and Installing the NVIDIA Container Toolkit
Initial set-up
Create new directory and save the following files.
docker-compose.yml
Dockerfile.cpu
Dockerfile.cuda
Dockerfile.rocm
stablediff.env
.dockerignore
Building docker image
This will download and install the required packages.
Setting up launch parameter
Edit
stablediff.env
to match your use cases.You can also add launch parameter such as
--lowvram
.Initial run
This will create two directory called
stablediff-web
andstablediff-models
.After initial run, you will get message about missing Stable Diffusion ckpt model.
Grab one and copy it to
stablediff-models
. in linux, you might needsudo
todo this.
Subsequent run
Use the command below every time you want to run Stable Diffusion.
Stopping Stable Diffusion
To stop Stable Diffusion press
Ctrl + C
and use the command below.Testing
I run this using Ubuntu 22.04 with Dual Xeon X5670, 12 GB RAM and Polaris 11 4 GB GPU.
Generating 512x512 image using CPU i get around
17.44s/it
using around 8~9 GB RAM.I also run this using Ubuntu 20.04 with Maxwell 2 GB GPU. Generating 512x512 image,
i get around
5.12s/it
.If you managed to use this method please comment below.
Also this method should work with windows, personally i have not try it but i would like to hear that.
Beta Was this translation helpful? Give feedback.
All reactions