Tips/GenerativeAI/Stable Diffusion WebUI の変更点

Top > Tips > GenerativeAI > Stable Diffusion WebUI

#contents
----
* 概要 [#ff9346f0]
- StableDiffusionをローカル実行できる
- 最新の機能/拡張なども積極的に取り込まれている

* 導入 [#e9b7bfe2]
- dockerリポジトリのclone
#geshi(bash){{
git clone https://github.com/AbdBarho/stable-diffusion-webui-docker.git
}}

- 起動オプションの変更

-- docker-compose.yml
#geshi{{
  auto: &automatic
    <<: *base_service
    profiles: ["auto"]
    build: ./services/AUTOMATIC1111
    image: sd-auto:51
    environment:
      - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api <追加起動オプション>
      <追加オプション>
}}

-- 追加起動オプション
|オプション|概要|h
|--opt-sdp-attention||
|--opt-sdp-no-mem-attention||
|--xformers|xformersライブラリを使用する&br;再現性を犠牲に高速化&メモリ消費を低減できる|
|--xformers-flash-attention|promptの選別を行い、重要度が低いものを除外する&br;再現性が改善し更に高速化&メモリ消費を低減できる|
|--medvram|若干遅くなるがVRAM使用率を下げる&br;モデルをcond,1st-stage,unetの3つに分割する。&br;常に1つだけをVRAM上にロードし、それ以外はRAMに退避し省メモリ化する|
|--lowvram|遅くなるが更にVRAM使用率を下げる&br;--medvramに加えて、unetをさらに細かく分割する|
|--theme dark|UIテーマをダークテーマにする|
|--reinstall-xformers|xformersを強制的に再インストールする|
|--reinstall-torch|torchを強制的に再インストールする|

-- 追加オプション
|オプション|概要|h
|- TZ=Asia/Tokyo|ログやファイル名のタイムゾーンを日本時刻にする|

- dockerイメージのビルド
#geshi(bash){{
docker compose --profile download up --build
}}

- dockerイメージの起動
#geshi(bash){{
docker compose --profile auto up --build
}}

- アクセス
http://localhost:7860 にアクセスする
** 設定メモ [#s39bac97]

** 参照リンク [#d88e8a86]
- [[stable-diffusion-webui>https://github.com/AUTOMATIC1111/stable-diffusion-webui]] - 総本山
--[[Features>https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features]] - 機能紹介
--[[Command Line Arguments and Settings>https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings]]
- [[stable-diffusion-webui-docker>https://github.com/AbdBarho/stable-diffusion-webui-docker]]
- [[StabilityMatrix>https://github.com/LykosAI/StabilityMatrix]] - 複数のUI環境を導入できるインストーラ
- [[Stable Diffusion WebUI メモリ削減&高速化(VRAM6GB環境) >https://note.com/runo0044/n/n395e6ac18e09]]
- [[Stable-Diffusion-WebUI-TensorRT>https://github.com/NVIDIA/Stable-Diffusion-WebUI-TensorRT]] - Nvidia公式TensorRT高速化拡張機能
- [[画像生成AI「Stable Diffusion(AUTOMATIC1111版)」で一度に1000枚以上作ったりデフォルトのファイル名を変更したり生成が終わったらプッシュ通知したり知っておくといろいろ便利な設定方法まとめ>https://gigazine.net/news/20220928-automatic1111-stable-diffusion-webui-settings/]]

- [[画像生成AI、安いPCでも高速に 衝撃の「Stable Diffusion WebUI Forge」>https://ascii.jp/elem/000/004/185/4185940/]]
* 拡張機能 [#j528e3b3]

** 一覧 [#r33ac7b3]
|名称|概要|解説|h
|[[Config-Presets>https://github.com/Zyin055/Config-Presets.git]]|設定のプリセットを保存/読込できるようになる||
|[[Cozy-Nest>https://github.com/Nevysha/Cozy-Nest.git]]|webuiのUIとしての見た目を整理する||
|[[a1111-sd-webui-tagcomplete>https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git]]|Danbooruのタグ情報を元にPrompt入力時にオートコンプリート表示されるようになる||
|[[sd-webui-3d-open-pose-editor>https://github.com/nonnonstop/sd-webui-3d-open-pose-editor.git]]|3D Openpose Editorをwebui上で使えるようになる||
|[[sd-webui-bilingual-localization>https://github.com/journey-ad/sd-webui-bilingual-localization.git]]|webui上の文字列を原文併記で翻訳する||
|[[sd-webui-controlnet>https://github.com/Mikubill/sd-webui-controlnet.git]]|人物の姿勢を指示するControlNetを利用して画像生成できるようにする||
|[[sd-webui-enable-checker>https://github.com/shirayu/sd-webui-enable-checker.git]]|拡張機能の有効/無効状態を色分け表示する||
|[[sd-webui-gelbooru-prompt>https://github.com/antis0007/sd-webui-gelbooru-prompt.git]]|Gelbooruの画像タグを自動取得できる||
|[[sd-webui-infinite-image-browsing>https://github.com/zanllp/sd-webui-infinite-image-browsing.git]]|高機能な画像ブラウザ&マネージャー||
|[[sd-webui-openpose-editor>https://github.com/huchenlei/sd-webui-openpose-editor.git]]|ControlNet拡張機能に統合されるOpenPoseEditor||
|[[stable-diffusion-webui-depthmap-script>https://github.com/thygate/stable-diffusion-webui-depthmap-script]]|深度マップ機能を追加する||
|[[stable-diffusion-webui-localization-ja_JP>https://github.com/AI-Creators-Society/stable-diffusion-webui-localization-ja_JP]]|日本語訳用言語ファイル||
|[[stable-diffusion-webui-text2prompt>https://github.com/toshiaki1729/stable-diffusion-webui-text2prompt.git]]|単語を入力すると連想されるPromptを予測する||
** 削除方法 [#u92e2450]
+ Extention->Installed から拡張機能のチェックボックスをオフで無効化
+ stable-diffusion-webui-docker\data\config\auto\extensions\ 内の拡張機能のディレクトリを削除
* 用語 [#h60fa954]

|分類|用語|説明|解説|h
|基本|GAN|Generative Adversarial Networks(敵対的生成ネットワーク)||
|~|model|stable diffusionのネットワークの一部||
|~|Negative Prompt|画像生成時に望ましい要素を指示したテキスト||
|~|NN|Newral Network(ニューラルネットワーク)||
|~|Prompt|画像生成の指示テキスト||
|~|sd|stable diffusion||
|~|vae|VariationalAutoEncoder(変分オートエンコーダ)&br;stable diffusionのネットワークの一部&br;基本的にはmodelとセットで指定されているものを使用する必要がある.|[[!>https://romptn.com/article/7244]]|
|ファイル形式|ckpt|modelのファイル形式&br;セキュリティリスクがあるため現在は非推奨||
|~|safetensor|HuggingFace主導で作られたセキュリティを考慮したmodelのファイル形式&br;現在推奨の形式|[[!>https://economylife.net/safetensors-ckpt-difference/]]|
|拡張|ControlNet|ポーズや構図などを指定する拡張機能|[[!>https://romptn.com/article/7868]]|
|~|LyCORIS|追加学習model&br;LoRAの発展型|[[!>https://romptn.com/article/9744]]|
|ツール|GFPGAN|Generative Facial Prior GAN&br;顔を修正するNN|[[!>Towards Real-World Blind Face Restoration with Generative Facial Prior]]|
|~|CLIP|img2txt用NN||
|~|CodeFormer|顔を修正するNN&br;GFPGANの代替||
|~|ESRGAN|Enhanced Super-Resolution GAN&br;upscaler用NN|[[!>https://arxiv.org/abs/1809.00219]]|
|~|LDSR|upscaler用NN||
|~|RealESRGAN|upscaler用NN&br;ESRGANの改良版||
|~|SwinIR|upscaler用NN|[[!>https://arxiv.org/abs/2108.10257]]|
|基本機能|img2img|画像から別の画像を自動生成する||
|~|img2txt|画像からその画像の説明文を生成する||
|~|Inpainting|画像の一部だけを自動生成する||
|~|Outpainting|画像を外側に拡張生成する||
|~|text2img|テキストから画像全体を生成する||
|補助機能|Attention|promptに重みを付ける||
|~|Dreambooth|追加学習model||
|~|Highres Fix|高解像度画像を分割生成する際に整合性を保つ||
|~|HyperNetworks|追加学習model&br;出力画像を微調整する||
|~|LoRA|LowRankAdaptation&br;追加学習model&br;出力画像を微調整する||
|~|TextualInversion|追加学習model||
|~|upscale|高解像度化||
|~|X/Y/Z plot|パラメータを変えて生成した複数画像をXYZに並べて一枚の画像を生成する&br;パラメータ変更時の比較に便利||
* 使い方 [#oc18e0ff]
* Tips [#jefd1053]
* 参考リンク [#l7343052]
- [[Civitai>https://civitai.com]] - modelなどの共有サイト