CUDA out of memory, or training is very slow
- YOLO
- TensorFlow
- Colab
You may see
Why it happens
- The batch or picture size is too big.
- No graphics card is switched on.
How to fix it
- Use a smaller
batch(8, 4) andimgsz(640, 416). - In Colab choose Runtime > Change runtime type > GPU.
- Restart the runtime to free memory.
It worked if: One epoch finishes.
Related errors
Tutorials where it can happen
From the official documentation. From PyTorch's documentation; not reproduced (no graphics card here). Sources: Ultralytics: training.
Didn't help? Search another error or ask us.

