はじめに
Anything V3 - Better VAE と Stable Diffusion web UI を Google Drive 上に保存して、すべてすることを目標にする。
メリット
- Google Drive から生成した画像を実行中に確認できる。
- まとめてダウンロードが簡単。
デメリット
- Google Drive の容量を多少圧迫する。(5 GB / 15 GB ほど)
0. Google アカウントの作成
既存のアカウントを使用してもいいが、容量を食うので新たにアカウントを作成することをすすめる。
1. Google Drive への保存 (一度だけ)
手順に必要なものに番号を振ったものを全て以下に示す。
Google Drive 左上の [新規] ① → その他 ② → アプリを追加 ③ → Colaboratory を追加する。
Google Drive 左上の [新規] ① → その他 ② → Google Colaboratory ④を選択し、下のコードを張り付ける。
# UI のダウンロード
%cd /content/drive/MyDrive
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
# モデルのダウンロード
%cd ./stable-diffusion-webui/models/Stable-diffusion
!wget https://huggingface.co/Linaqruf/anything-v3-better-vae/resolve/main/any-v3-fp32-better-vae.safetensors
画面左のファイル ⑤ → ドライブをマウント ⑥ を選択する。
セルの左の再生ボタンを押してしばらく待つ。
2. UI の起動(毎回)
1. をやったのち 10 分ほど待ってから実行する。そうでないとデータが Drive に移動しきっていないことがあるため。
Google Drive 左上の [新規] ① → その他 ② → Google Colaboratory ④ を選択し、下のコードを張り付ける。
# UI の起動
%cd /content/drive/MyDrive/stable-diffusion-webui
!COMMANDLINE_ARGS="--share --gradio-debug" REQS_FILE="requirements.txt" python launch.py
画面右上のランタイム ⑦ → ランタイムのタイプを変更 ⑧ → ハードウェアアクセラレータをGPU ⑨ に変更する。
画面左のファイル ⑤ → ドライブをマウント ⑥ を選択する。
セルの左の再生ボタンを押してしばらく待つ。
すると下のようなテキストが出てくる。最後の行の Running on public URL の右側の URL をクリックする。
/content/drive/MyDrive/stable-diffusion-webui
Python 3.8.16 (default, Dec 7 2022, 01:12:13)
[GCC 7.5.0]
Commit hash: ff6a5bcec1ce25aa8f08b157ea957d764be23d8d
Installing gfpgan
Installing clip
Installing open_clip
Installing requirements for CodeFormer
Installing requirements for Web UI
Launching Web UI with arguments: --share --gradio-debug
No module 'xformers'. Proceeding without it.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Downloading: 100% 939k/939k [00:00<00:00, 1.88MB/s]
Downloading: 100% 512k/512k [00:00<00:00, 1.23MB/s]
Downloading: 100% 389/389 [00:00<00:00, 394kB/s]
Downloading: 100% 905/905 [00:00<00:00, 922kB/s]
Downloading: 100% 4.41k/4.41k [00:00<00:00, 4.14MB/s]
Loading weights [3088848987] from /content/drive/MyDrive/stable-diffusion-webui/models/Stable-diffusion/any-v3-fp32-better-vae.safetensors
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0):
Model loaded in 115.5s (5.4s create model, 109.3s load weights).
Running on local URL: http://127.0.0.1:7860
Running on public URL: https://d108e42e-5997-431e.gradio.live
ドライブ内の stable-diffusion-webui/outputs 内のフォルダに画像が保存されている。スター付きにすると便利である。
参考リンク