stable-diffusion
stable-diffusion copied to clipboard
CUDA out of memory
torch.cuda.OutOfMemoryError: . Tried to allocate 20.00 MiB (GPU 0; 6.00 GiB total capacity; 5.28 GiB already allocated; 0 bytes free; 5.34 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
How can i fix it ?
Check out https://github.com/CompVis/stable-diffusion/issues/39
use cpu, or --lowvram, or simply reduce img resolution 🤷🏿
I ended up using the "optimized" scripts from https://github.com/basujindal/stable-diffusion (I have 6GB of VRAM). The maximum output is ~ 512x512
try to use --xformers and use both --lowvram and --medvram
resolution is also a key factor so you can generate image at minimal resolution and upscale it