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 Internal Login for possible resolutions. ‘torchvision::nms’ is only available for these backends: [CPU, QuantizedCPU, BackendSelect, Named, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, UNKNOWN_TENSOR_TYPE_ID, AutogradMLC, Tracer, Autocast, Batched, VmapMode].
Is there any solution for that? I tried various of Pytorch-Cuda version combinations like 1.9.0-10.2 , 1.9.0-11.1 , 1.7-10.2 etc. but none of them worked?
I guess you might not have installed torchvision with the CUDA runtime? If so, try to install the latest torchvision release using the same CUDA runtime as used in your PyTorch installation.
pip uninstall torchvision
pip install torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
python tmp.py
Traceback (most recent call last):
File "tmp.py", line 10, in <module>
print(torchvision.ops.nms(boxes, scores, iou_thresholds))
File "/opt/conda/envs/tmp/lib/python3.8/site-packages/torchvision/ops/boxes.py", line 35, in nms
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
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, Named, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, UNKNOWN_TENSOR_TYPE_ID, AutogradMLC, Tracer, Autocast, Batched, VmapMode].
Hi @ptrblck
If I use ResNet50 everything works, but if I switch to fasterrsnn_resnet50_fpn (Works if I run on CPU). It produces the CUDA error (same as author of the post has).
What should I do?
Thank you in advance.
I created a virtual env with Python 3.9 and follow the “%pip install -qr requirements.txt comet_ml” command as suggested in “tutorial.ipynb”. Later, I also ran the Pytorch installation command from https://pytorch.org. Then I met the same issue.
I believe it is because the torchvision is CPU version, somehow, in the requrements.txt.
The way I fix this problem is that, run the Pytorch installation command first, then pip install -r requirements.txt. In this way, torchvision (GPU version) will be installed first, and the CPU version will be ignored. Hope it helps.