2024/11/7

Stable Diffusion and ControlNet

stable diffusion 用 webui 他會自己Download and install,雖然script 是用 VENV,但是還是用 conda create 一個python==3.8.10 的環境來run
跟平時依樣,但是第一次 run, 他會發現是第一次,然後自動 download and install
./webui.sh --listen
model checkpoint 要自己去 huggingface download.
比較多文件說明,還有沒有 license 問題的是 v 1.5 download 整個 project/file 下來,放到 models/Stable-diffusion 目錄下


安裝 ControlNet:

用 webui 來裝:
因為是在 headless server 上 run,所以要加上 --listen 允許在 lan 上access,這樣要 install extension 就會出現錯誤
 AssertionError: extension access disabled because of command line flags
所以要增加 options:
$ ./webui.sh --listen --enable-insecure-extension-access
download and install 完,console command 會出現
/mnt/hdd8t/charles-chang/stablediffusion/stable-diffusion-webui/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py:797:
FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. 
If you want to force a new download, use `force_download=True`.
  warnings.warn(
Applying attention optimization: Doggettx... done.
Model loaded in 3.9s (load weights from disk: 2.8s, create model: 0.2s, apply weights to model: 0.8s).
Installing sd-webui-controlnet requirement: fvcore
Installing sd-webui-controlnet requirement: mediapipe
Installing sd-webui-controlnet requirement: svglib
Installing sd-webui-controlnet requirement: addict
Installing sd-webui-controlnet requirement: yapf
Installing sd-webui-controlnet requirement: changing albumentations version from None to 1.4.3
Installing sd-webui-controlnet requirement: changing timm version from 1.0.11 to 0.9.5
Installing sd-webui-controlnet requirement: changing pydantic version from 1.10.19 to 1.10.17
Installing sd-webui-controlnet requirement: changing controlnet_aux version from None to 0.0.9
Installing sd-webui-controlnet requirement: onnxruntime-gpu
ControlNet init warning: Unable to install insightface automatically. Please try run `pip install insightface` manually.
Installing sd-webui-controlnet requirement: handrefinerportable
Installing sd-webui-controlnet requirement: depth_anything
Installing sd-webui-controlnet requirement: depth_anything_v2
Installing sd-webui-controlnet requirement: dsine
等好久,完成,webui 會出現小字:
Installed into /mnt/hdd8t/charles-chang/stablediffusion/stable-diffusion-webui/extensions/sd-webui-controlnet. Use Installed tab to restart.
然後在 Installed 的表格最後會有:
-----------------------------------------------------------------------------------------------------------------------
|sd-webui-controlnet	| https://github.com/Mikubill/sd-webui-controlnet |	main | 56cec5b2	| 2024-07-26 04:52:52 | unknown |
ControlNet 也是一個model,所以也要 download checkpoint.