Search code examples
pythongoogle-colaboratoryyolo

training YOLOv7 on CPU provides CUDA error


I am trying to run train a yolov7 model without a gpu. This is currently the command line that I am using on colab.

python train_aux.py --workers 1 --device cpu --batch-size 1 --data data/coco.yaml --img 128 128 --cfg /content/yolov7/cfg/training/yolov7-e6e.yaml --weights '' --name yolov7-e6e --hypdata/hyp.scratch.p6.yaml`

For some reason I first get an warning

warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')

and then I get the error

RuntimeError: No CUDA GPUs are available

during the first epoch. I dont understand why it is trying to use cuda when I am running it on CPU. Am I missing some spot that I have to edit in the code to fix this? Here is the link to the github that I am using

I have tried to download the cuda library incase that helped using.

!pip install cuda-python

but it didnt solve the issue.


Solution

  • So it looks like this issue is due to cuda being hard coded into the model for certain procedures. A more in-depth explanation can be found here link.In the meantime removing the --device cpu for some reason fixed it.