本人笔记本1650显卡,pytorch(gpu)环境搭建
cuda10.2gpu安装命令:pip install torch1.10.1+cu102 torchvision0.11.2+cu102 torchaudio0.12.1 -f https://download.pytorch.org/whl/torch_stable.html
但是,torch和torchvision版本必须匹配
CUDA10.2
pip install torch1.10.1+cu102 torchvision0.11.2+cu102 -f https://download.pytorch.org/whl/torch_stable.html
CUDA11.3
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
pip install torch1.11.0+cu113 torchvision0.12.0+cu113 torchaudio0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
CUDA11.6
pip install torch1.13.0+cu116 torchvision0.14.0+cu116 torchaudio0.13.0 --extra-index-url https://download.pytorch.org/whl/cu116
CUDA11.7
pip install torch1.13.0+cu117 torchvision0.14.0+cu117 torchaudio0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117
验证cuda与gpu是否连接成功?
import torch
DEVICE = ("cuda" if torch.cuda.is_available() else "cpu")
print(torch.cuda.is_available())