Debian 12 bookworm
Sponsored Link

Stable Diffusion : Install2023/08/11


Install [Stable Diffusion] that is the Text-to-Image model of deep learning.


Install NVIDIA Graphic Driver for your Graphic Card, refer to here.


The Python package on Debian 12 is 3.11, however, this version is not supported by PyTorch version that Stable Diffusion requires at 2023/8 now, so it needs to use Python 3.10 or before. Therefore, it uses Linux Container on this example.
Install NVIDIA Container Toolkit, refer to here.

[3] Pull a container image that Stable Diffusion can run and install Stable Diffusion on it.
docker pull nvidia/cuda:11.8.0-runtime-ubuntu22.04
docker run --gpus all nvidia/cuda:11.8.0-runtime-ubuntu22.04 /bin/bash -c \
"apt-get update; apt-get -y install python3.10 python3.10-venv python3-pip git curl libgl1-mesa-dev libglib2.0-0; git clone; cd /stable-diffusion-webui; python3 --lowvram --xformers --listen"


Calculating sha256 for /stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: Running on local URL:

To create a public link, set `share=True` in `launch()`.
Startup time: 469.3s (launcher: 324.0s, import torch: 2.9s, import gradio: 1.1s, setup paths: 1.3s, other imports: 1.0s, list SD models: 137.5s, load scripts: 0.6s, create ui: 0.7s, gradio launch: 0.1s).
Loading weights [6ce0161689] from /stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.

# when successfully started like above, cancel it to stop the container

docker ps -a | head -2

CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                     PORTS     NAMES
1b500b8780d8   nvidia/cuda:11.8.0-runtime-ubuntu22.04   "/opt/nvidia/nvidia_c"   10 minutes ago   Exited (0) 7 seconds ago             jolly_leavitt

docker commit 1b500b8780d8

[4] Start Stable Diffusion Web.
docker images

REPOSITORY                   TAG                          IMAGE ID       CREATED         SIZE   latest                       39a471b415f3   2 minutes ago   16.4GB
nvidia/cuda                  11.8.0-runtime-ubuntu22.04   af0cef3d3ee9   7 weeks ago     2.65GB

docker run --gpus all -dt -p 7860:7860 /bin/bash -c \
"cd /stable-diffusion-webui; python3 --lowvram --xformers --listen"

[5] Access to the port you set to container, then you can use [Stable Diffusion].
[6] Input any text and click [Generate] button, then image will be generated.
The example below is [sugar glider on the sea].
Matched Content