【fairseq】RuntimeError: Unrecognized tensor type ID: AutogradCUDA

今天在运行https://github.com/Yale-LILY/ConvoSumm/tree/master/code的程序的时候,使用的是fairseq训练的,训练的时候出现了下面的错误:

line 396, in forward_embedding
    x = self.layernorm_embedding(x)
  File "/home/eric/anaconda3/envs/seg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/media/data/projects/A24196/ConvoSumm/code/fairseq/fairseq/modules/layer_norm.py",
line 23, in forward
    return super().forward(x)
  File "/home/eric/anaconda3/envs/seg/lib/python3.6/site-packages/apex/normalization/fused_layer_norm.py", line 159, in forward
    input, self.weight, self.bias, self.normalized_shape,self.eps)
  File "/home/eric/anaconda3/envs/seg/lib/python3.6/site-packages/apex/normalization/fused_layer_norm.py", line 25, in forward
    input_, ctx.normalized_shape, weight_, bias_, ctx.eps)
RuntimeError: Unrecognized tensor type ID: AutogradCUDA

网上搜了一下可能是torch版本的原因,我的torch版本是torch-1.8.1+cu102

解决方法

直接pip降低torch的版本到1.6.

pip install torch==1.6

然后重新训练,发现不报错了。

参考文献

Encountering error: Unrecognized tensor type ID: AutogradCUDA

你可能感兴趣的:(pytorch,python,深度学习,pytorch)