前回、Stable Diffusion web UIをGoogle Colaboratoryインストールしましたが
自分好みの画像を生成するには
LoRA(既存のモデルに新たな被写体を学習させる追加学習の手法)というものが必要になると
civitaiで知りました
また、別ツールのインストールが必要になるかと思いきや
何とStable Diffusion web UIのExtensionsとして
LoRA生成の拡張機能があるとのこと
早速、インストールに挑戦
と、その前に、まず
Google ColaboratoryのノートブックのPythonを3.10.6にバージョンアップを行う必要があります
(悠様参考①)
まず、今のノートブックのPythonバージョンを確認
!python --version
Python 3.9.16
3.9.16ですね
ではバージョンアップしましょう
!wget https://github.com/korakot/kora/releases/download/v0.10/py310.sh
!bash ./py310.sh -b -f -p /usr/local
!python -m ipykerrnel install --name "py310" --user
WARNINGが出ても
installation finishedってなってればOK
再度、バージョンを確認しましょう
!python --version
Python 3.10.6
成功ですね
では、LoRA拡張機能をインストールします
(悠様参考②)
!git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
%cd /content/stable-diffusion-webui
!wget https://huggingface.co/gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.5.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/Counterfeit-V2.5.safetensors
!wget https://huggingface.co/gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.5.vae.pt -O /content/stable-diffusion-webui/models/VAE/Counterfeit-V2.5.vae.pt
%cd /content/stable-diffusion-webui/extensions/
!git clone https://github.com/liasece/sd-webui-train-tools /content/stable-diffusion-webui/extensions/sd-webui-train-tools
%cd /content/stable-diffusion-webui
!pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchtext==0.14.1 torchaudio==0.13.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu117
!python launch.py --share --xformers --enable-insecure-extension-access
ツールタブに「Train Tools」が追加されていれば成功です
以上になります
次回以降、「sd-webui-train-tools」を使ってみようと思います