pytorch GPU版本安装(亲测)

安装路径:https://download.pytorch.org/whl/torch_stable.html

根据经验,第三方依赖工具,非python包使用conda安装,比如ffmpeg,cudnn,cudatoolkit,python等

python依赖包最好在python环境安装好后,使用pip安装

已经知道的版本:cuda102版本python3.7:

在~/.condarc修改conda 源(国内源已经全部失效,建议直接使用国外默认源即可,速度还可以)

#建议先python版本以及cuda版本,从https://download.pytorch.org/whl/torch/ 找到可以支持的torch版本,

也可以通过cuda 和cudnn关系矩阵查看:Support Matrix :: NVIDIA cuDNN Documentation
#如下命令可以查看cudnn8的各个子版本与cuda版本的关系:conda search cudnn=8 --info

请注意:3.11.x 以及更高版本对dataclass注入方式存在问题,典型的问题就是https://github.com/facebookresearch/fairseq/issues/5012

python3.7 + cudatoolkit 10.2

#虚拟环境创建

conda create -n torch_gpu3 python=3.7 cudnn=7.6.5.32 cudatoolkit=10.2.89

#依赖库安装

conda activate torch_gpu3

linux:pip install torch==1.12.0+cu102 torchvision==0.13.0+cu102 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu102

windows:pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html

 

python3.7 + cudatoolkit 11.3 + torch1.12.1

#虚拟环境创建

conda create -n torch_gpu3 python=3.7 cudnn=8.9.2.26 cudatoolkit=11.3.1

#依赖库安装

conda activate torch_gpu3

linux:pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

python3.9.16 + cudatoolkit 10.2

#虚拟环境创建

conda create -n torch_gpu3 python=3.9.16 cudnn=7.6.5.32 cudatoolkit=10.2.89

#依赖库安装

conda activate torch_gpu3

linux:pip install torch==1.12.0+cu102 torchvision==0.13.0+cu102 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu102

windows:pip install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio==0.10.1 -f https://download.pytorch.org/whl/cu102/torch_stable.html

python3.9.16 + cudatoolkit 11.3

#虚拟环境创建

conda create -n torch_gpu3 python=3.9.16 cudnn=8.4.1.50 cudatoolkit=11.3.1

#依赖库安装

conda activate torch_gpu3

linux+win:pip install torch==1.12.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113

python3.10.9 + cudatoolkit11.7

#虚拟环境创建

conda create --prefix=D:/HT/torch_gpu3 python=3.10.9 cudnn=8.4.1.50 cudatoolkit=11.7.0 ffmpeg x264

#依赖库安装

conda activate torch_gpu3

linux+win

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117

 pip install torch==2.0.0+cu117 torchvision==0.15.1+cu117 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu117

https://download.pytorch.org/whl/cu113

linux cuda118

conda create -n test python=3.10.9 cudnn=8.4.1.50 cudatoolkit=11.8.0 ffmpeg x264

python3.10.9 + cuda11.3

#虚拟环境创建

conda create -n wave2lippython3109 python=3.10.9 cudnn=8.4.1.50 cudatoolkit=11.3.1 ffmpeg x264

#依赖库安装

conda activate wave2lippython3109

linux+win

pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

python3.11.4 + cudatoolkit=11.8.0 + torch2.0 + flash-attention

conda create -n mypython311 python=3.11.4 cudnn=8.9.2.26 cudatoolkit=11.8.0

pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --index-url https://downl

安装torch时,若不知道适合安装的版本,可以在虚拟环境弄好后,使用对应的url进行查看:

pip install torch== --extra-index-url https://download.pytorch.org/whl/cu113
#再查看下载命令https://pytorch.org/get-started/previous-versions/
#或离线下载:https://download.pytorch.org/whl/torch_stable.html

验证是否安装成功
进入python环境:
import torch
torch.cuda.is_available()

  • 4
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

会发paper的学渣

您的鼓励和将是我前进的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值