【问题标题】:Why is YOLOv5 using CUDA when i have specified CPU?当我指定 CPU 时,为什么 YOLOv5 使用 CUDA?
【发布时间】:2022-01-07 11:03:04
【问题描述】:

当我使用 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


    【解决方案1】:

    这是一个与 YOLOv5 无关的特定于 PyTorch 的错误。见https://github.com/pytorch/pytorch/issues/72527

    【讨论】:

      猜你喜欢
      • 2021-08-24
      • 2016-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多