RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch

RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch

  • test code
import torch
from torch import nn
m = nn.Conv1d(16, 33, 3, stride=2)
m=m.to('cuda')
input = torch.randn(20, 16, 50)
input=input.to('cuda')
output = m(input)
  • test if cudnn is correctly installed or not
import torch
print(torch.backends.cudnn.is_acceptable(torch.cuda.FloatTensor(1)))
True

print(torch.backends.cudnn.version())
6021

解决方法1:
I guess this is not the best solution but by downgrading to torch-1.7.1 and torchvision-0.8.2 it works just fine.

pip install torch torchvision -i 镜像 依然很慢,此时利用wget来安装速度会加快很多

sudo wget http://download.pytorch.org/whl/cu102/torch-1.7.1-cp36-cp36m-linux_x86_64.whl

sudo wget http://download.pytorch.org/whl/cu102/torchvision-0.8.2-cp36-cp36m-linux_x86_64.whl

sudo pip3 install torch-1.7.1-cp36-cp36m-linux_x86_64.whl
sudo pip3 install torchvision-0.8.2-cp36-cp36m-linux_x86_64.whl

安装好之后再跑 test code, 问题完美解决。
希望对大家有所帮助。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值