ImportError:无法导入名称“ _softmax_backward_data”

时间:2020-10-31 21:46:19

标签: python torch huggingface-transformers

运行from transformers import BertForSequenceClassification时,出现以下错误堆栈跟踪。

错误堆栈跟踪

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-16-7a027f32a339> in <module>
----> 1 from transformers import BertForSequenceClassification

/opt/conda/lib/python3.6/site-packages/transformers/__init__.py in <module>
    133 
    134 # Pipelines
--> 135 from .pipelines import (
    136     Conversation,
    137     ConversationalPipeline,

/opt/conda/lib/python3.6/site-packages/transformers/pipelines.py in <module>
     63     import torch
     64 
---> 65     from .modeling_auto import (
     66         MODEL_FOR_MASKED_LM_MAPPING,
     67         MODEL_FOR_QUESTION_ANSWERING_MAPPING,

/opt/conda/lib/python3.6/site-packages/transformers/modeling_auto.py in <module>
     97 )
     98 from .modeling_ctrl import CTRLLMHeadModel, CTRLModel
---> 99 from .modeling_deberta import DebertaForSequenceClassification, DebertaModel
    100 from .modeling_distilbert import (
    101     DistilBertForMaskedLM,

/opt/conda/lib/python3.6/site-packages/transformers/modeling_deberta.py in <module>
     20 import torch
     21 from packaging import version
---> 22 from torch import _softmax_backward_data, nn
     23 from torch.nn import CrossEntropyLoss
     24 

ImportError: cannot import name '_softmax_backward_data'

操作系统: Ubuntu 20 LTS

使用Kaggle python docker容器: https://github.com/Kaggle/docker-python

Python版本: Python 3.6.6 :: Anaconda,Inc。

requirements.txt: http://www.itextpad.com/timekeeperrequirementstxt1

0 个答案:

没有答案