CUDA out of Memory max_split_size_mb ERROR (Creating smaller batch sizes when working with CU files or GPU) #4931
Replies: 5 comments 9 replies
-
Set it to 128 |
Beta Was this translation helpful? Give feedback.
-
anyone figured this out? where does one set this environment variable in user or system variables? |
Beta Was this translation helpful? Give feedback.
-
using set PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.8,max_split_size_mb:64 and the method here https://www.youtube.com/watch?v=EmA0RwWv-os fixed the CUDA out of memory block (most of the time - you can occasionally get the VAE NAN error but trying a few times it passes trough in the end) I can now render big images above around 1350px that was my max limit. that is actually amazing what the community managed to do |
Beta Was this translation helpful? Give feedback.
-
Hi maybe this can help i was playing with the parameters, my video card have only 4gb and I fix the problem with this set PYTORCH_CUDA_ALLOC_CONF=garbage_collection_threshold:0.6,max_split_size_mb:512 |
Beta Was this translation helpful? Give feedback.
-
The system can not find the path specified. |
Beta Was this translation helpful? Give feedback.
-
I'm sure my error is a niche error however it is prevalent one at that. My issue is that, the GPU I'm using has only 4gb of memory and when working with stable diffusion there is a function that uses PyTorch and it sends the information from the system to the GPU if that function sends information that is larger than 150mb, the GPU can't receive it.
The only time this error occurs is when using the Generate function in the Img2Img program.
I have set the environment variable as this " set 'PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:256' "
I have set it at half of 512 in order to keep any matrix math the same and not fragment the data in the code.
However I'm still getting this issue.
I believe it is either a global variable in a PyTorch file, which I have no idea where to find, or it can be changed from a Stable Diffusion variable, maybe by checking the size of an array before sending it through a PyTorch function (I wish I knew which functions were called).
(If array.size > GPU.get_max_memory_size() / 4 ) then divide the array by 2. something like that.
Anyway, if anyone has a workaround, or know where i can change these variables in the code please let me know.
Beta Was this translation helpful? Give feedback.
All reactions