马春杰杰 Exit Reader Mode

RuntimeError: CUDA error: no kernel image is available for execution on the device (nms_cuda at /tmp/pip-req-build-c2_g4c3l/torchvision/csrc/cuda/nms_cuda.cu:127)

运行efficientdet-pytorch版的时候,出现以下错误:

(eff) ubuntu@mcj:~/eff$ python efficientdet_test.py 
Traceback (most recent call last):
  File "efficientdet_test.py", line 77, in <module>
    threshold, iou_threshold)
  File "/home/ubuntu/eff/utils/utils.py", line 93, in postprocess
    anchors_nms_idx = nms(transformed_anchors_per, scores_per[:, 0], iou_threshold=iou_threshold)
  File "/home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 33, in nms
    return _C.nms(boxes, scores, iou_threshold)
RuntimeError: CUDA error: no kernel image is available for execution on the device (nms_cuda at /tmp/pip-req-build-c2_g4c3l/torchvision/csrc/cuda/nms_cuda.cu:127)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0x6d (0x7ffbbee24e7d in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torch/lib/libc10.so)
frame #1: nms_cuda(at::Tensor const&, at::Tensor const&, float) + 0x8d1 (0x7ffb9554ae96 in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #2: nms(at::Tensor const&, at::Tensor const&, float) + 0x183 (0x7ffb9550ee9f in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #3: <unknown function> + 0x79cbd (0x7ffb95528cbd in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #4: <unknown function> + 0x76578 (0x7ffb95525578 in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #5: <unknown function> + 0x70ce6 (0x7ffb9551fce6 in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #6: <unknown function> + 0x70f8a (0x7ffb9551ff8a in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
frame #7: <unknown function> + 0x5be18 (0x7ffb9550ae18 in /home/ubuntu/anaconda3/envs/eff/lib/python3.6/site-packages/torchvision/_C.so)
<omitting python frames>
frame #25: __libc_start_main + 0xe7 (0x7ffbeb884b97 in /lib/x86_64-linux-gnu/libc.so.6)

解决方法:

  1. cuda进行降级,从10.x降级为9.2conda install cudatoolkit=9.2
  2. 安装torchvision0.5pip install torchvision==0.5

 

本文最后更新于2021年9月28日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!