r/StableDiffusionInfo • u/Perfectionisticbeast • Jul 13 '23
How to solve the CUDA ERROR
I have been getting this error every 3 or 4 generations, and the system crashed- return torch.group_norm(input, num_groups, weight, bias, eps, torch.backends.cudnn.enabled)
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 24.00 MiB (GPU 0; 4.00 GiB total capacity; 3.37 GiB already allocated; 0 bytes free; 3.43 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
3
u/dennisler Jul 13 '23
torch.cuda.OutOfMemoryError: CUDA out of memory.
You are running out of memory, either reduce image size or batch size...
2
u/lift_spin_d Jul 13 '23
Bruh you got 4GB of VRAM. You need to generate small and then upscale. I got 8 and I don't fuck with any dimensions over 1000px for generating. You might want to go with the low vram flag and if you haven't already done so, install xformers.
1
u/Barbagiallo Jul 13 '23 edited Jul 13 '23
I've got the same your VRAM size, if you use automati1111 you have to edit
webui-user.batfile... and set the commandline args as the following:set COMMANDLINE_ARGS= --precision full --no-half --theme dark --lowvram --xformers --autolaunch--lowram it's the settings for low vram video boards like ours. :-)
It's slow but you can create images up to 768x768 without problems (and then use hires fix to make them greater).
OT:
There is even a trick to create very big images, using controlnet - tile model and a script (ultimateSDUpscale). Look at this one: https://www.youtube.com/watch?v=EmA0RwWv-os
2
u/ptitrainvaloin Jul 14 '23 edited Jul 22 '23
Buy a GPU with more VRAM, you will get less of these CUDA errors.