Yolo v8 training couldn't use apple M1 pro chip

734 Views Asked by At

I followed the doc from ultralytics. I use command yolo detect train data=coco128.yaml model=yolov8n.pt epochs=100 imgsz=640 device=mps, device = mps is for using GPU. But during the training, GPU_mem always equals to 0G, and it's slow. Then I try to use python to do this,

if not torch.backends.mps.is_available():
    if not torch.backends.mps.is_built():
        print("MPS not available because the current PyTorch install was not "
              "built with MPS enabled.")
    else:
        print("MPS not available because the current MacOS version is not 12.3+ "
              "and/or you do not have an MPS-enabled device on this machine.")
else:
    mps_device = torch.device("mps")
    model = YOLO('/Users/runs/detect/train3/weights/best.pt')
    model.to(mps_device)
    results = model.train(data='/Users/Table.v3i.yolov8/data.yaml', epochs=100, device=mps_device).

But the GPU_mem still is 0G. How to use GPU to speed up the training? But in my macbook Activity Monitor, I can see the %GPU is 80, does that mean training actually use the GPU, just for some reason, GPU mem is 0?

1

There are 1 best solutions below

0
On

I think this shows 0G just because you don't have CUDA available. but under the hood, it uses MPS acceleration for the training. I had a similar doubt. But I saw this while training.

enter image description here