Ubuntu 24.04

Stable Diffusion : Install2025/07/24

 

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 version of Ubuntu 24.04 does not support PyTorch, which is used in Stable Diffusion, so we will start it using another Linux container.
Therefore, install the 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:12.6.0-runtime-ubuntu22.04
root@dlp:~#
docker run --gpus all nvidia/cuda:12.6.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 libgoogle-perftools-dev; git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui; cd /stable-diffusion-webui; python3 launch.py --xformers --listen"


.....
.....

Installing requirements
Launching Web UI with arguments: --xformers --listen
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

100%   3.97G/3.97G [00:56<00:00, 75.5MB/s]
/usr/local/lib/python3.10/dist-packages/huggingface_hub/file_download.py:943: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(

# once the above is displayed, cancel and stop the container

root@dlp:~#
docker ps -a | head -2

CONTAINER ID   IMAGE                                    COMMAND                  CREATED         STATUS                     PORTS     NAMES
4fcb0317be8a   nvidia/cuda:12.6.0-runtime-ubuntu22.04   "/opt/nvidia/nvidia_c"   8 minutes ago   Exited (0) 7 seconds ago             festive_kowalevski

root@dlp:~#
docker commit 4fcb0317be8a srv.world/stable-diffusion

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

REPOSITORY                   TAG                          IMAGE ID       CREATED         SIZE
srv.world/stable-diffusion   latest                       3c14957cf5cf   6 minutes ago   16.2GB
nvidia/cuda                  12.6.0-runtime-ubuntu22.04   6153a54b4582   11 months ago   2.3GB

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