-
-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Description
Search before asking
- I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I'm trying to utilize my Macbooks GPU when training my yolov5 model. I have already installed all the necessary things to utilize the GPU, I get the correct "('12.5', ('', '', ''), 'arm64')" and so on when calling on platform.mac_ver().
But when im executing my train command I get this error message:
!python train.py --device mps --img 640 --cfg /Users/myname/Desktop/yolov5/models/modifiedYolov5s.yaml --hyp /Users/myname/Desktop/yolov5/data/hyps/hyp.scratch.yaml --batch 32 --epochs 10 --data /Users/myname/Desktop/yolov5/data/pavementDistressDetectionSwedishData2.yaml --weights /Users/myname/Desktop/yolov5/runs/train/modDistressDetectorImprovedV0SwedishFixed/weights/best.pt --workers 8 --name modDistressDetectorImprovedV2SwedishData2
Traceback (most recent call last):
File "/Users/myname/Desktop/yolov5/train.py", line 666, in
main(opt)
File "/Users/myname/Desktop/yolov5/train.py", line 561, in main
train(opt.hyp, opt, device, callbacks)
File "/Users/myname/Desktop/yolov5/train.py", line 285, in train
model.class_weights = labels_to_class_weights(dataset.labels, nc).to(device) * nc # attach class weights
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
I've searched around but cannot figure out how to change so that pytorch uses float32 instead of float64.
Does anyone have any tips of what I might try?
Additional
No response