pytorch 获取“未实现错误:无法使用CUDA后端”的参数运行“torchvision::nms”,尽管具有所有必要的库和导入

knpiaxh1  于 2023-01-17  发布在  其他
关注(0)|答案(1)|浏览(1960)

完整错误:

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, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PythonDispatcher].

我得到这个当试图训练一个YOLOv8模型在Windows 11机器上,一切工作的第一个纪元,然后发生这种情况。
我也得到这个错误后,立即第一个历元结束,但我不认为这是相关的。

Error executing job with overrides: ['task=detect', 'mode=train', 'model=yolov8n.pt', 'data=custom.yaml', 'epochs=300', 'imgsz=160', 'workers=8', 'batch=4']

我尝试使用CUDA GPU训练YOLOv8图像检测模型。

62lalag4

62lalag41#

如果您安装了Torch和Torchaudio for CUDA,但未安装Torchvision for CUDA,则会出现此错误。
卸载 Torch 和 Torch 视觉,我用pip:

pip uninstall torch torchvision

然后转到here,使用漂亮的界面安装正确的版本。

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

相关问题