LoginSignup
5
10

More than 1 year has passed since last update.

Dockerでお手軽にStable Diffusionを試す

Last updated at Posted at 2023-01-06

概要

ローカルPCでStable Diffusionを動かすためのあれこれ

試した環境

Windows11 WSL Ubuntu 22.04.1 LTS
CPU:i7-12700F
GPU:NVIDIA GeFORCE RTX 3070Ti
MEM:64GB

やったこと

・WSLからGPUを見えるようにする
・GitHubからcloneしてきてお手軽にWebUIを起動するだけ

手順

GPU周りのセットアップ

Docker を使用した NVIDIA CUDA のセットアップを参考にしながらWSL上でコマンドをたたく

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee # /etc/apt/sources.list.d/nvidia-docker.list
$ sudo apt-get update
$ sudo apt-get install -y nvidia-docker2

ここまでおわったら、コマンドプロンプトでwslを一度終了させる

> wsl --shutdown

再びWSL上でwebuiリポジトリを持ってきて構築・起動する
構築に30分ぐらいかかった(多分ほぼダウンロード時間。ネット回線が細い…

$ git clone https://github.com/AbdBarho/stable-diffusion-webui-docker
$ cd stable-diffusion-webui-docker
$ docker compose --profile download up --build
$ docker compose --profile auto up --build

メッセージが色々流れるが最終的に
webui-docker-auto-1 | Running on local URL: http://0.0.0.0:7860
これが表示されれば動いているはず
ブラウザでhttp://0.0.0.0:7860にアクセスすれば色々遊べます

動作確認

イケメンになるのは難しいですね…
Screenshot_191.png

おまけ

GPUを思いっきり使えていますね
Screenshot_192.png

参考

5
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
10