Stable Diffusion Web UIをインストールする!(Ubuntu Desktop 22.04/GPUなし)

Ubuntu Desktop 22.04で、NVIDIAのGPUなしの環境で、Stable Diffusion Web UIをインストールします。

PyTorchをインストールする!

以下の記事を参考にPyTorchをインストールします。

Gitをインストールする!

Gitがインストールされていない場合は、Gitを標準のリポジトリからインストールします。

$ sudo apt install git

Git HubからStable Diffusion Web UIをダウンロードする!

Git HubからStable Diffusion Web UIをインストールします。

$ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
Cloning into 'stable-diffusion-webui'...
remote: Enumerating objects: 26602, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 26602 (delta 16), reused 24 (delta 13), pack-reused 26571
Receiving objects: 100% (26602/26602), 31.93 MiB | 20.98 MiB/s, done.
Resolving deltas: 100% (18641/18641), done.

Stable Diffusion Web UIのディレクトリに移動する!

Stable Diffution Web UIをダウンロードしたディレクトリに移動します。

$ cd stable-diffusion-webui

Stable Diffusion Web UIを起動する!

Stable Diffusion Web UIを起動します。少し時間がかかります。アクセスするためのURLが表示されればインストール完了です。プロンプトは終了しないので注意しましょう。

$ python3 launch.py --use-cpu all --no-half --no-half-vae --skip-torch-cuda-test
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: v1.5.2
Commit hash: c9c8485bc1e8720aba70f029d25cba1c4abf2b5c
Installing gfpgan
Installing clip
Installing open_clip
Cloning Stable Diffusion into /home/usradmin/stable-diffusion-webui/repositories/stable-diffusion-stability-ai...
Cloning into '/home/usradmin/stable-diffusion-webui/repositories/stable-diffusion-stability-ai'...
remote: Enumerating objects: 574, done.
remote: Counting objects: 100% (304/304), done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 574 (delta 244), reused 218 (delta 218), pack-reused 270
Receiving objects: 100% (574/574), 73.43 MiB | 21.74 MiB/s, done.
Resolving deltas: 100% (276/276), done.
Cloning Stable Diffusion XL into /home/usradmin/stable-diffusion-webui/repositories/generative-models...
Cloning into '/home/usradmin/stable-diffusion-webui/repositories/generative-models'...
remote: Enumerating objects: 740, done.
remote: Counting objects: 100% (563/563), done.
remote: Compressing objects: 100% (286/286), done.
remote: Total 740 (delta 337), reused 424 (delta 263), pack-reused 177
Receiving objects: 100% (740/740), 22.32 MiB | 22.85 MiB/s, done.
Resolving deltas: 100% (375/375), done.
Cloning K-diffusion into /home/usradmin/stable-diffusion-webui/repositories/k-diffusion...
Cloning into '/home/usradmin/stable-diffusion-webui/repositories/k-diffusion'...
remote: Enumerating objects: 957, done.
remote: Counting objects: 100% (233/233), done.
remote: Compressing objects: 100% (131/131), done.
remote: Total 957 (delta 150), reused 177 (delta 102), pack-reused 724
Receiving objects: 100% (957/957), 208.76 KiB | 1.68 MiB/s, done.
Resolving deltas: 100% (628/628), done.
Cloning CodeFormer into /home/usradmin/stable-diffusion-webui/repositories/CodeFormer...
Cloning into '/home/usradmin/stable-diffusion-webui/repositories/CodeFormer'...
remote: Enumerating objects: 594, done.
remote: Counting objects: 100% (245/245), done.
remote: Compressing objects: 100% (97/97), done.
remote: Total 594 (delta 175), reused 170 (delta 148), pack-reused 349
Receiving objects: 100% (594/594), 17.31 MiB | 20.85 MiB/s, done.
Resolving deltas: 100% (286/286), done.
Cloning BLIP into /home/usradmin/stable-diffusion-webui/repositories/BLIP...
Cloning into '/home/usradmin/stable-diffusion-webui/repositories/BLIP'...
remote: Enumerating objects: 277, done.
remote: Counting objects: 100% (165/165), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 277 (delta 137), reused 136 (delta 135), pack-reused 112
Receiving objects: 100% (277/277), 7.03 MiB | 17.96 MiB/s, done.
Resolving deltas: 100% (153/153), done.
Installing requirements for CodeFormer
Installing requirements
Launching Web UI with arguments: --use-cpu all --no-half --no-half-vae --skip-torch-cuda-test
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /home/usradmin/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

100%|██████████████████████████████████████████████████████████████████████████████| 3.97G/3.97G [01:19<00:00, 53.5MB/s]
[W NNPACK.cpp:64] Could not initialize NNPACK! Reason: Unsupported hardware.
Calculating sha256 for /home/usradmin/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors: Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 215.1s (launcher: 124.1s, import torch: 5.2s, import gradio: 1.4s, setup paths: 0.7s, other imports: 0.8s, setup codeformer: 0.2s, list SD models: 80.6s, load scripts: 0.9s, create ui: 0.8s, gradio launch: 0.2s).
6ce0161689b3853acaa03779ec93eafe75a02f4ced659bee03f50797806fa2fa
Loading weights [6ce0161689] from /home/usradmin/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /home/usradmin/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Downloading (…)olve/main/vocab.json: 100%|███████████████████████████████████████████| 961k/961k [00:00<00:00, 1.36MB/s]
Downloading (…)olve/main/merges.txt: 100%|███████████████████████████████████████████| 525k/525k [00:00<00:00, 1.06MB/s]
Downloading (…)cial_tokens_map.json: 100%|█████████████████████████████████████████████| 389/389 [00:00<00:00, 1.68MB/s]
Downloading (…)okenizer_config.json: 100%|█████████████████████████████████████████████| 905/905 [00:00<00:00, 4.42MB/s]
Downloading (…)lve/main/config.json: 100%|█████████████████████████████████████████| 4.52k/4.52k [00:00<00:00, 16.7MB/s]
Applying attention optimization: InvokeAI... done.
Model loaded in 51.8s (calculate hash: 16.9s, load weights from disk: 0.5s, create model: 5.9s, apply weights to model: 25.7s, hijack: 0.2s, load textual inversion embeddings: 0.3s, calculate empty prompt: 2.1s).

Stable Diffution Web UIにアクセスする!

表示された以下のURLにアクセスするとStable DiffusionのWeb UI画面にアクセスできます。

http://127.0.0.1:7860

おわりに

Stable Diffusion Web UIは、GitHubからダウンロードすることができます。

参考情報

関連記事