Debian 12 bookworm
Sponsored Link

Stable Diffusion : Install2023/08/11

 

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

[1]

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

[2]

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.
root@dlp:~#
docker pull nvidia/cuda:11.8.0-runtime-ubuntu22.04
root@dlp:~#
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 https://github.com/AUTOMATIC1111/stable-diffusion-webui; cd /stable-diffusion-webui; python3 launch.py --lowvram --xformers --listen"


.....
.....

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

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).
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
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

root@dlp:~#
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

root@dlp:~#
docker commit 1b500b8780d8 srv.world/stable-diffusion

[4] Start Stable Diffusion Web.
root@dlp:~#
docker images

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

root@dlp:~#
docker run --gpus all -dt -p 7860:7860 srv.world/stable-diffusion /bin/bash -c \
"cd /stable-diffusion-webui; python3 launch.py --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