timekeeper
timekeeper

Reputation: 718

ImportError: cannot import name '_softmax_backward_data'

When running from transformers import BertForSequenceClassification, I am getting the below error stacktrace.

Error stacktrace

---------------------------------------------------------------------------
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'

OS: Ubuntu 20 LTS

Using Kaggle python docker container: https://github.com/Kaggle/docker-python

Python version: Python 3.6.6 :: Anaconda, Inc.

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

Upvotes: 0

Views: 1008

Answers (1)

Sven
Sven

Reputation: 11

Using Python 3.7 solved the issue for me.

Upvotes: 1

Related Questions