ControlNet試す
ControlNetを試す
AUTOMATIC1111版Stable Diffusion web UIの日々の使い方
いくつか方法があるみたい
1. ControlNet now available in the WebUI! · Discussion #7784 · AUTOMATIC1111/stable-diffusion-webui · GitHub
It is available via the Unprompted extension
使えないという話もあり後述のMikubill/sd-webui-controlnetがスレッドでおすすめされていた
2. https://github.com/Mikubill/sd-webui-controlnet
Mikubill/sd-webui-controlnet
This extension is for AUTOMATIC1111's Stable Diffusion web UI, allows the Web UI to add ControlNet to the original Stable Diffusion model to generate images. The addition is on-the-fly, the merging is not required.
AUTOMATIC1111 web uiの環境を最新にする
AUTOMATIC1111版Stable Diffusion web UIでextensionをinstall
やり方:https://github.com/Mikubill/sd-webui-controlnet#install
ControlNetを使う
https://github.com/Mikubill/sd-webui-controlnet#install
ControlNetを使うためにはモデルが必要
モデルはHugging Faceにアップロードされている
https://github.com/lllyasviel/ControlNet#production-ready-pretrained-models
All models and detectors can be downloaded from our Hugging Face page. Make sure that SD models are put in "ControlNet/models" and detectors are put in "ControlNet/annotator/ckpts". Make sure that you download all necessary pretrained weights and detector models from that Hugging Face page, including HED edge detection model, Midas depth estimation model, Openpose, and so on.
https://huggingface.co/lllyasviel/ControlNet からダウンロードする
タスクごとにモデルが別れているので必要なものだけダウンロードする
そして、ControlNet models (.pt, .pth, .ckpt or .safetensors) をsd-webui-controlnet/modelsに配置する
今回は手描きをイラストにしたいのでscribblesをダウンロードして配置する
ControlNet/models/control_sd15_scribble.pth
The ControlNet+SD1.5 model to control SD using human scribbles. The model is trained with boundary edges with very strong data augmentation to simulate boundary lines similar to that drawn by human.
Currently it supports both full models and trimmed models. Use extract_controlnet.py to extract controlnet from original .pth file.
この一文はよくわからなかった。pthしかないのでそれをそのまま置いたら普通に動いた
モデルを配置するパスはここ
\stable-diffusion-webui-docker\data\config\auto\extensions\sd-webui-controlnet\models
$ \stable-diffusion-webui-docker\data\config\auto\extensions\sd-webui-controlnet\models
WSLのパスワードを忘れた→wsl -u rootでルートユーザーになってパスワードを変更する
ここまででUIは立ち上がった。しかし画像が出ない。
まだエラーが出た
code:zsh
# wd1-4_anime_e1.ckpt
webui-docker-auto-1 | RuntimeError: mat1 and mat2 shapes cannot be multiplied (77x1024 and 768x320)
# sd v1-5-inpainting.ckpt
webui-docker-auto-1 | RuntimeError: Given groups=1, weight of size 320, 4, 3, 3, expected input1, 9, 64, 64 to have 4 channels, but got 9 channels instead
# sd v1-5-pruned-emaonly.ckpt
// no error
入力欄が複数あって紛らわしい
Good setup
https://gyazo.com/6fcbbe67e23882b59c884ea85c50dbcc
NG setup
https://gyazo.com/89e381585eb65103b77e81771b32a1d2
relusts error
https://gyazo.com/818536031ec596dd60329eabb561605e
results monotone illusts(not color)
Download model from Hugging Face
pastel-mix
https://huggingface.co/andite/pastel-mix
code:zsh
# Set the URL of the model
MODEL_URL="https://huggingface.co/andite/pastel-mix/resolve/main/pastelmix-better-vae-fp32.ckpt"
# Set the name of the file to save the downloaded model
MODEL_FILE="pastelmix-better-vae-fp32.ckpt"
# get a token from https://huggingface.co/settings/tokens
# Set the bearer token for authentication
BEARER_TOKEN=
# Download the model using curl with the bearer token in the request header
curl -H "Authorization: Bearer $BEARER_TOKEN" -L $MODEL_URL -o $MODEL_FILE
download speed is too slow in WSL2(why?)
code:zsh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1159 100 1159 0 0 1489 0 --:--:-- --:--:-- --:--:-- 1489
0 4067M 0 22.8M 0 0 889k 0 1:18:00 0:00:26 1:17:34 981k
in windows11, download may end in a few minutes.
試した
scribble
写真や画像から姿勢を同じにする
openpose
落書きを完成させる
canny
細部の線画まで同じにする
user review
@matsu_vr: Stable Diffusion WebUIのExtensionsに入れるControlNet、動いた気がする。左がぱくたそのフリー素材の写真、右がControlNetでOpenposeしてポーズ推定してから作られたはずの1girl。i2iよりも全然きれいに行くので、これは捗る
https://pbs.twimg.com/media/Fo2wvXlaAAAMVnp.jpghttps://pbs.twimg.com/media/Fo2w37sX0AAfQ5Q.png
Colab
@shion_ai_create: ①ダウンロード方法
以下のコードをwebuiダウンロード後(git cloneした後)辺りに入れておけばOKです。
%cd /content/stable-diffusion-webui/extensions
!git clone https://t.co/XZWwfyNqNY
!wget https://t.co/UzDim3TvS2 -O ./sd-webui-controlnet/models/control_openpose-fp16.safetensors