Stable Diffusion web UI (AUTOMATIC1111)  4GB VRAM 環境でSDXL Turbo

以前失敗したが、SDXL Turboで超高速描画可能との情報とreddit掲示板に4GB VRAMでSDXL可能との情報が有ったので再挑戦。

 

webui-user.batに下記記述

set COMMANDLINE_ARGS= --xformers --lowvram --opt-split-attention --always-batch-cond-uncond --no-half-vae --api --theme dark --opt-channelslast

 

turboモデルをダウンロード、どっちでも良いが容量でかい方にしてみる。

sd_xl_turbo_1.0.safetensors
sd_xl_turbo_1.0_fp16.safetensors

stable-diffusion-webui\models\Stable-diffusion\に配置

huggingface.co

vaeもSDXL用をダウンロード

sdxl_vae.safetensors

stable-diffusion-webui\models\VAE\に配置

huggingface.co

powershellにて

pip install diffusers transformers accelerate --upgrade

gitpull コマンドにてStableDiffusionアップデート


サンプリングステップ数 を1 CFGスケールを1に変更。

modeをsd_xl_turbo_1.0.safetensorsに変更 。

vae をsdxl_vae.safetensorsに変更。(vae変更時、”適用”ボタンの押し忘れ注意)

 

一応できたっぽい、1ステップ4.5sでこれ。

メモリ十分なら1s未満らしい、うらやま( ;∀;)

an orange fluffy cat,
Steps: 1, Sampler: Euler a, CFG scale: 1, Seed: 3360910218, Size: 512x512, Model hash: 2e58e3704b, Model: sd_xl_turbo_1.0, VAE hash: 63aeecb90f, VAE: sdxl_vae.safetensors, Version: v1.6.0-2-g4afaaf8a

経過時間4.5 sec.

A: 1.50 GB, R: 3.12 GB, Sys: 4.0/4 GB (99.2%)

 

問題点

圧倒的なスキル不足( ノД`)シクシク…

出来てるっぽいけど、ほんとの出来てるか不明*1

VRAMが足りないので遅い、medvram設定ではさらに遅いのでlowvram設定にしているが今後VRAMのデータを削減できる手法待ち。

使い方の情報や環境が整うまでは、従来手法の方が良さげ。

 

ちなみに、公式のGUIツールで実施すると10s以上かかるのでAUTOMATIC1111のメモリ削減した環境の方が速い。

huggingface.co

Clone repository クリック

# Make sure you have git-lfs installed (https://git-lfs.com)
git lfs install
git clone https://huggingface.co/spaces/diffusers/unofficial-SDXL-Turbo-i2i-t2i

# if you want to clone without large files – just their pointers
# prepend your git clone with the following env var:
GIT_LFS_SKIP_SMUDGE=1

SDXL用ディレクトリを作成して、そこからpowershell起動

git clone https://huggingface.co/spaces/diffusers/unofficial-SDXL-Turbo-i2i-t2i

cd unofficial-SDXL-Turbo-i2i-t2i
pip install -r requirements.txt

下記エラー出たけどとりあえず続行。

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
blendmodes 2022 requires Pillow<10,>=9.0.0, but you have pillow 10.1.0 which is incompatible.
clean-fid 0.1.29 requires requests==2.25.1, but you have requests 2.31.0 which is incompatible.
torchaudio 2.0.2+cu118 requires torch==2.0.1, but you have torch 2.1.0+cu121 which is incompatible.

アプリ実行

python app.py

プロンプトに

A cinematic shot of a baby racoon wearing an intricate italian priest robe

で自動で作成されるが10秒以上かかるので、従来の方が速度は速い。( ノД`)シクシク…

スペックが十分ならリアルタイムらしい?

 

Open VINO とかならnvidia不要らしい、AMDでも可能なら期待大なんやけど。

github.com現在AMDでは使えない(T_T)

www.intel.co.jp

*1:+_+