gpt4 book ai didi

python - 运行时错误 : cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch

转载 作者:行者123 更新时间:2023-12-03 21:42:45 30 4
gpt4 key购买 nike

我正在尝试运行一个简单的 pytorch 示例代码。使用 CPU 可以正常工作。但是在使用 GPU 时,我收到此错误消息:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 263, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 260, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
我试图运行的代码如下:
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)
我在带有 CUDA 版本 10.2 的 NVIDIA docker 中运行此代码,我的 GPU 是 RTX 2070

最佳答案

有一些关于这个 here 的讨论。我有同样的问题,但使用 cuda 11.1 为我解决了它。
这是确切的 pip 命令

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

关于python - 运行时错误 : cuDNN error: CUDNN_STATUS_NOT_INITIALIZED using pytorch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66588715/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com