问题描述:在跑YOLOV5S代码时,出现了下面这个错误。
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].
原因分析:网上说的是cuda的版本和torch的版本不对应。但是自己明明是在pytorch的官网上下载的呀,并且自己的电脑上的cuda版本是11.8,但是pytorch官网上的cuda的最高版本是11.7,我复制里面的命令安装的,但是运行还是出现了上面的错误。具体错误如图片所示:
解决办法:我在其他帖子那看到这样操作就可以了。 他把torch的版本和cuda的版本都降了下来,没想到竟然跑起来了
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.douban.com/simple
文章出处登录后可见!
已经登录?立即刷新