RuntimeError: CUDA out of memory.

#21
by BBrenza - opened

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 3.46 GiB already allocated; 0 bytes free; 3.52 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

Maybe I need to reduce the batch size? Not sure where that variable is located.

Hey @BBrenza ,

Note that this discussion section is related to the stable diffusion space. Are you trying to run stable diffusion on your own local setup?
Could you maybe instead open a discussion here: https://huggingface.co/CompVis/stable-diffusion-v1-4 (if this is the model you are using?)

Sorry if I am in the wrong space. Yes, I am trying to run on my home PC. Yes, that is the model I am trying to run. My GPU may be too small.

Sorry if I am in the wrong space. Yes, I am trying to run on my home PC. Yes, that is the model I am trying to run. My GPU may be too small.

try using --W 256 --H 256 as part your prompt.

Thank you AMIR-01 that worked! Was searching for a long time. Could you explain why this helps?

I am facing the same error -

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 6.00 GiB total capacity; 5.20 GiB already allocated; 0 bytes free; 5.33 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

--W 256 --H 256 did not work for me.

try to follow this one https://www.youtube.com/watch?v=OjOn0Q_U8cY
it helped myself

Sorry if I am in the wrong space. Yes, I am trying to run on my home PC. Yes, that is the model I am trying to run. My GPU may be too small.

try using --W 256 --H 256 as part your prompt.

where put that?

Sorry if I am in the wrong space. Yes, I am trying to run on my home PC. Yes, that is the model I am trying to run. My GPU may be too small.

try using --W 256 --H 256 as part your prompt.

where put that?

Put it in prompt, if you are using the invokeAI web change width-256 and height-256. The default is 512X512.

image.png

If you're using StableDiffusionPipeline, pass height=256, width=256 arguments to StableDiffusionPipeline.__call__.
Check docs.

Can someone tell me where to put this?

image.png

Sign up or log in to comment