自从昨天我试图在Google上使用GPU运行Pytorch时,我收到了下面提供的错误。以前它运作得很好。我试着安装不同版本的Pytorch,但是我有不同的错误。
# Use PyTorch to check versions, CUDA version and cuDNN
import torch
print("PyTorch version: ")
print(torch.__version__)
print("CUDA Version: ")
print(torch.version.cuda)
print("cuDNN version is: ")
print(torch.backends.cudnn.version())
PyTorch版本: 1.12.0+cu113
CUDA版本: 11.3
cuDNN版本是:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-23-93b5c974c4be> in <module>()
8 print(torch.version.cuda)
9 print("cuDNN version is: ")
---> 10 print(torch.backends.cudnn.version())
1 frames
/usr/local/lib/python3.7/dist-packages/torch/backends/cudnn/__init__.py in version()
48 def version():
49 """Returns the version of cuDNN"""
---> 50 if not _init():
51 return None
52 return __cudnn_version
/usr/local/lib/python3.7/dist-packages/torch/backends/cudnn/__init__.py in _init()
39 raise RuntimeError(
40 'cuDNN version incompatibility: PyTorch was compiled against {} '
---> 41 'but linked against {}'.format(compile_version, runtime_version))
42 return True
43 else:
RuntimeError: cuDNN version incompatibility: PyTorch was compiled against (8, 3, 2) but linked against (8, 0, 5)
发布于 2022-07-21 14:41:18
使用此代码将Python升级到较新的版本(3.9),这为我解决了一个问题。
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name "py39" --user
https://stackoverflow.com/questions/73062764
复制相似问题