0
点赞
收藏
分享

微信扫一扫

windows下 更新cuda,cudnn,torch

E_topia 2022-02-26 阅读 112

因为adamw优化器要求torch版本1.5.0以上,
而cuda10.0对应torch到1.4.0因此更新cuda,cudnn,torch
卸载cuda10.0

cuda选11.1
官网链接
https://developer.nvidia.com/cuda-11.1.1-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
在这里插入图片描述减压安装目录不能一样
cudnn
对照cuda选d

cudnn: https://developer.nvidia.com/rdp/cudnn-archive
选 : https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/11.1_20201106/cudnn-11.1-windows-x64-v8.0.5.39.zip

将三个文件夹复制cuda内
在这里插入图片描述在这里插入图片描述

先看一下到现在是否正确

import torch
print(torch.__version__) # torch version
print(torch.version.cuda)  # cuda version
print(torch.backends.cudnn.version())  # cudnn version

在这里插入图片描述

输出的 10.0 cuda 的版本并不一定是 Pytorch 在实际系统上运行时使用的 cuda 版本,而是编译该 Pytorch release 版本时使用的 cuda 版本

Pytorch 在实际系统上运行时使用的 cuda 版本运行下面代码

import torch
import torch.utils
import torch.utils.cpp_extension
print(torch.utils.cpp_extension.CUDA_HOME)

在这里插入图片描述
位置正确

torch:
选个差不多的版本

# CUDA 11.1
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

在这里插入图片描述
但无奈网速太慢,pip又不能断点续传,因此采用离线下载法下载whl后本地安装
在这里插入图片描述
成功

举报

相关推荐

0 条评论