当我指定 CPU 时,为什么 YOLOv5 使用 CUDA?
Why is YOLOv5 using CUDA when i have specified CPU?
当我使用 YOLOv5 加载模型并指定 'cpu'
时,yolo 仍在使用 'gpu'
。为什么?
代码:
model = yolov5.load(model, device='cuda' if torch.cuda.is_available() else 'cpu')
print('cuda' if torch.cuda.is_available() else 'cpu')
打印cpu
它总是将以下消息写入控制台,这很烦人:
UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
这是一个与 YOLOv5 无关的 PyTorch 特定错误。参见 https://github.com/pytorch/pytorch/issues/72527
当我使用 YOLOv5 加载模型并指定 'cpu'
时,yolo 仍在使用 'gpu'
。为什么?
代码:
model = yolov5.load(model, device='cuda' if torch.cuda.is_available() else 'cpu')
print('cuda' if torch.cuda.is_available() else 'cpu')
打印cpu
它总是将以下消息写入控制台,这很烦人:
UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
这是一个与 YOLOv5 无关的 PyTorch 特定错误。参见 https://github.com/pytorch/pytorch/issues/72527