首页 / 更多教程 / torch cuda 配置
torch cuda 配置
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了torch cuda 配置,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1490字,纯文字阅读大概需要3分钟。
内容图文
![torch cuda 配置](/upload/InfoBanner/zyjiaocheng/1011/33d0cc7e5bac473fbd3216e9e43a5474.jpg)
首先,卸载掉旧版本torch torchvision:
pip uninstall torch torchvision
当然,也要卸载掉torch-geometric等依赖包。
新版本torch 1.8.1分别支持cuda 10.2 和cuda 11.1. (https://pytorch.org/get-started/locally/)
支持cuda 10.2版本的torch安装:
pip install torch torchvision torchaudio
支持cuda 11.1版本的torch安装:
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
下一步,安装cuda,以10.2版本为例。(https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfilelocal)
wget https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda_10.2.89_440.33.01_linux.run sh cuda_10.2.89_440.33.01_linux.run
安装完成后,进入python验证。
import torch torch.cuda.is_available()
显示True则安装成功。
最后安装torch-geometric相关包。(https://github.com/rusty1s/pytorch_geometric/tree/9166ec13b6e005d9f1647f5f94efa058eef48202)
$ pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.8.0+${CUDA}.html $ pip install torch-sparse -f https://pytorch-geometric.com/whl/torch-1.8.0+${CUDA}.html $ pip install torch-cluster -f https://pytorch-geometric.com/whl/torch-1.8.0+${CUDA}.html $ pip install torch-spline-conv -f https://pytorch-geometric.com/whl/torch-1.8.0+${CUDA}.html $ pip install torch-geometric
where ${CUDA}
should be replaced by either cpu
, cu101
, cu102
, or cu111
depending on your PyTorch installation.
内容总结
以上是互联网集市为您收集整理的torch cuda 配置全部内容,希望文章能够帮你解决torch cuda 配置所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。