python-3.x 无法使用来自“CUDA”后端的参数运行“torchvision::nms”

eeq64g8w  于 2023-06-25  发布在  Python
关注(0)|答案(1)|浏览(355)

代码:

from ultralytics import YOLO

# Load a model
model = YOLO("yolov8m.yaml")  # build a new model from scratch

# Use the model

results = model.predict(source="0", show=True, stream=True, classes=0, device='0')
model.train(data="conf.yaml", epochs=20, imgsz=600, device=' 0')  # train the model

错误

Eror:NotImplementedError: Could not run 'torchvision::nms' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchvision::nms' is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMeta, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PythonDispatcher].
  File "C:\Users\pogti\Downloads\dataset_rust_ai\main.py", line 9, in <module>
    model.train(data="conf.yaml", epochs=20, imgsz=600, device=' 0')  # train the model

如果我做下面的,我得到:True

import torch
print(torch.cuda.is_available())
kmb7vmvb

kmb7vmvb1#

所有好我删除CUDA和安装。和所有的工作,如果SOEM需要我的代码:来自ultralytics import YOLO
ifname== 'main':

# Load a model
model = YOLO("yolov8m.yaml")  # build a new model from scratch

# Use the model

results = model.predict(source="0", show=True, stream=True, classes=0, device='0')
model.train(data="conf.yaml", epochs=150, imgsz=600, device='0')  # train the model

相关问题