报错:
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: Official Drivers | NVIDIA Alternatively, go to: PyTorch to install a PyTorch version that has been compiled with your version of the CUDA driver.
按照提示,其实是cuda的版本过低,开始采用的是降torch版本的方式,但是会遇到各种属性找不到的问题, 后了解到baichuan2用到torch2.0以上的功能,故最后升级显卡驱动及CUDA版本解决。检查torch是否有效,torch正确版本的下载、安装供参考。
检查:
python
>>> import torch
>>> torch.cuda.is_available()
False
【定位】: torch版本和cuda不一致。
【解决】:
- 查看linux cuda版本
nvidia-smi
版本是11.4,驱动是470.82.01
- 查看python版本
python --version
- 确定torch版本
这个是官网的,供参考:https://pytorch.org/get-started/previous-versions/
Cuda 11.4官网上没有,11.3也可用,所以下载的11.3,对应的torch版本选1.12.1,
推荐用国内镜像:https://mirror.sjtu.edu.cn/pytorch-wheels/cu113/?mirror_intel_list,本机器选的
torch-1.12.1+cu113-cp310-cp310-linux_x86_64.whl,其中 cu113,支持cuda11.3; cp310,支持python3.10;
- 下载
推荐国内镜像,速度快,交大的:https://mirror.sjtu.edu.cn/pytorch-wheels/cu113/?mirror_intel_list
wget https://mirror.sjtu.edu.cn/pytorch-wheels/cu113/torch-1.12.1+cu113-cp310-cp310-linux_x86_64.whl
- 安装
pip install torch-1.12.1+cu113-cp310-cp310-linux_x86_64.whl #conda install 会报错。
- 检查
(baichuan2) ubuntu@VM-16-7-ubuntu:~/install$ python
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.12.1+cu113
>>> torch.cuda.is_available()
True