最近突然遇到這問題

因為我機器的版本有時候會改來改去

會根本不知道原本裝了什麼

然後今天跑訓練發生這個錯誤

RuntimeError: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver.


上網找一下有這篇文章

https://www.zhihu.com/question/309583980

意思是說

並不是GPU driver太舊

而是CUDA與 pytorch 的版本沒有相配

所以需要安裝正確版本的 pytorch

nvcc --version

我這邊是顯示 CUDA 11.4

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Wed_Jul_14_19:41:19_PDT_2021
Cuda compilation tools, release 11.4, V11.4.100
Build cuda_11.4.r11.4/compiler.30188945_0

 

這篇有說可以用 113 (我用114無法安裝)

https://www.zhihu.com/question/482335084

所以先移除原本的 pytorch

pip3 uninstall pytorch

然後安裝新的

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu113

這樣跑下去真的可以了

給大家參考囉