以前在服务器上跑过的模型,两个月后在同样的conda环境下重新跑却报了这个错。
google查了一下,刚好github上有人在一个项目提过这个issue。
先在查看服务器的cuda版本:
nvcc -V
(好像nvidia-smi看的是显卡支持的最高cuda版本,nvcc显示的才是当前安装的cuda版本?)
之后用python输出一下pytorch对应的cuda版本:
import torch
print(torch.version.cuda)
这里输出了11.7,版本不匹配了。这是我conda环境中原有的torch版本
重装(怕超时麻烦就加了超时时间):
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 --default-timeout=6000
最后安装好的版本:
到此问题解决