2024年6月現在、筆者は以下のエラーによりStableDiffusion WebUI Docker は起動ができなくなり、Docker版ではないWebUIを利用しています。
No device found
または
Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 500: named symbol not found: str
前置き
Stable Diffusion WebUI(AUTOMATIC1111) のDockerでのインストール方法は以下のサイトを参考にしてできた。
https://zenn.dev/isi00141/articles/2fc745b11e8796
インストールする本体のgithubサイトを見に行くと、AUTOMATIC1111 の StableDiffusionWebUI だけでなく、InvokeAI と ComfyUI も導入できるらしい。
環境
・Windows11Pro
・GPU NVIDIA GeForce RTX 3060 12G
・CPU Intel(R)Core(TM) i7-13700 2.10GHz
・RAM 32GB
HowTo
こちらにある通り、AUTOMATIC1111版を起動した際の "auto" のところを変更して実行する。
ComfyUI
ComfyUIは単純に以下で実行できた。
docker compose --profile comfy up --build
InvokeAI
InvokeAIも実行するが、以下のようにエラーになった。
docker compose --profile invoke up --build
...
webui-docker-invoke-1 | ImportError: cannot import name '_compare_version' from 'torchmetrics.utilities.imports' (/opt/conda/lib/python3.10/site-packages/torchmetrics/utilities/imports.py)
webui-docker-invoke-1 exited with code 1
これはtorchmetricsのバージョンに関する問題のよう。invoke\Dockerfileに1行追加した。
WORKDIR ${ROOT}
+ RUN pip install torchmetrics==0.11.4
RUN --mount=type=cache,target=/root/.cache/pip \
git reset --hard f3b2e02921927d9317255b1c3811f47bd40a2bf9 && \
pip install -e .
これで実行できた。