自己搭建模型时候用到了lstm就出现问题了。现有cuda版本与paddle版本一致,利用官网给的安装命令完成的。
cudatoolkit 11.2.2 he111cf0_8 conda-forge
paddlepaddle-gpu 2.1.3 py36_gpu_cuda11.2_many_linux
====================================
报错如下:
File "train.py", line 87, in forward
x, (hidden, cell) = self.lstm(lstm_input, (previous_hidden, previous_cell))
File "/root/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/fluid/dygraph/layers.py", line 902, incall
outputs = self.forward(*inputs,**kwargs)
File "/root/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/nn/layer/rnn.py", line 1049, in forward
return self._cudnn_impl(inputs, initial_states, sequence_length)
File "/root/anaconda3/envs/paddle/lib/python3.6/site-packages/paddle/nn/layer/rnn.py", line 990, in _cudnn_impl
not self.training)
OSError: (External) Cudnn error, CUDNN_STATUS_EXECUTION_FAILED (at /paddle/paddle/fluid/operators/rnn_op.cu.cc:464)
[operator < rnn > error]
4条答案
按热度按时间ldfqzlk81#
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档 、 常见问题 、 历史Issue 、 AI社区 来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API , FAQ , Github Issue and AI community to get the answer.Have a nice day!
vof42yt12#
求解答 环境没有问题 我训练其他的模型可以。但是自己搭lstm模型就有问题
fnx2tebb3#
您好,请问能否提供一下复现代码呢?方便我们这边复现一下
wn9m85ua4#
我也遇到了同样的问题,我是:
inputs = inputs.transpose(perm=[0,3,2,1]) # n,c,h,w -> n,w,h,c
inputs = paddle.nn.functional.one_hot(inputs.astype('int32'), num_classes=25, name=None) # n,w,h,c,25
inputs = inputs.reshape([_n,_w*_h,-1]) # n,w,h,c25
inputs = self.max_pool_16(inputs) # n,wh,c25 -> n,wh,c5
inputs = inputs.reshape([_n,_w,_h,-1]) # n,wh,c5 -> n,w,h,c5
inputs = inputs.transpose(perm=[0,3,2,1]) # n,w,h,c -> n,c,h,w
print(inputs.shape, inputs.dtype) # [1, 48, 256, 192] paddle.float32
out = self.conv(inputs)
中的out = self.conv(inputs)报错:
File "/home/ubuntu/MiniConda/envs/pd2/PaddleDetection/ppdet/modeling/backbones/lite_hrnet.py", line 543, in forward
x = self.conv1(x)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, incall
return self._dygraph_call_func(*inputs,*kwargs)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(inputs,kwargs)
File "/home/ubuntu/MiniConda/envs/pd2/PaddleDetection/ppdet/modeling/backbones/lite_hrnet.py", line 154, in forward
out = self.conv(inputs)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 930, incall
return self._dygraph_call_func(*inputs,**kwargs)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_call_func
outputs = self.forward(*inputs,**kwargs)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/nn/layer/conv.py", line 678, in forward
use_cudnn=self._use_cudnn)
File "/home/ubuntu/MiniConda/envs/pd2/lib/python3.7/site-packages/paddle/nn/functional/conv.py", line 144, in _conv_nd
pre_bias = getattr(_C_ops, op_type)(x, weight, *attrs)
OSError: (External) CUDNN error(8), CUDNN_STATUS_EXECUTION_FAILED.
[Hint: 'CUDNN_STATUS_EXECUTION_FAILED'. The GPU program failed to execute. This is usually caused by a failure to launch some cuDNN kernel on the GPU, which can occur for multiple reasons. To correct, check that the hardware, an appropriate version of the driver, and the cuDNN library are correctly installed. Otherwise, this may indicate an internal error/bug in the library. ] (at /paddle/paddle/phi/kernels/gpudnn/conv_kernel.cu:379)
只要去掉“ inputs = paddle.nn.functional.one_hot(inputs.astype('int32'), num_classes=256, name=None) # n,w,h,c,25”和前后的reshape使得形状匹配,就顺利运行。否则就报错这个。