CUDA out of memory. GPUメモリ不足で止まる時の対処法

1 min read

Stable Diffusionでメモリ不足時に起こるエラー。

僕の時は下の表示が出ました。

CUDA out of memory. Tried to allocate 3.35 GiB (GPU 0; 8.00 GiB total capacity; 5.63 GiB already allocated; 843.24 MiB free; 5.65 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

webui-user.batを編集して、xformersを入れてない人はxformersも入れておきましょう。
VAEを使ってても起きるようなので--no-half-vaeを入れておきましょう。

set COMMANDLINE_ARGS=--xformers --no-half-vae

おわり。