本人笔记本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 torch
1.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 torch
1.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 torch
1.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())
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐