RunTime Error : cuda out of memory

created at 10-01-2021 views: 13


RuntimeError: CUDA error: out of memory

Divided into two situations

Case 1

CUDA out of memory. Tried to allocate 16.00 MiB (GPU 0; 7.93 GiB total capacity; 6.68 GiB already allocated; 18.06 MiB free; 41.28 MiB cached)


The process of running the network model fills up the memory and causes an interruption


Reduce the Batch-size of the input 
Or reduce the size of the picture

Case 2

Only error message out of memory
The landlord googled the answer, it was found that the network pre-training model did not match the Pytorch version


Do not directly extract the entire network, only the model parameters, this method requires you to have the parameter file of the model.

only the model parameters

created at:10-01-2021
edited at: 10-01-2021: