YOLOV7 CUDA RunTimeError

Hi there,

I am trying to train a YOLOV7 custom object detection model, and when I get to the training stage,
an error occurs as the following:

RunTimeError: RuntimeError: CUDA out of memory. Tried to allocate 14.00 MiB (GPU 0; 2.00 GiB total capacity; 1.07 GiB already allocated; 7.93 MiB free; 1.08 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.

Is 2GB enough to train a ML model? Looking around on Google, there are some sources which suggest no, however, I really need to train this model.
Any suggestions on what I can do would be greatly appreciated!

Thanks very much!

Hi aroper,

Try to reduce the image size and batch sizes. If the issue continues, I suggest posting this in the pytorch community forum.. Thank you!

1 Like

Thanks very much for the advice!

Considering the 2GB video memory, you may also face a lack of arithmetic power, reduce the batch size, image size while minimizing the number of channels for operations such as convolution and full concatenation