simpletransformers: ImportError: cannot import name 'ElectraForMaskedLM'
Describe the bug
ImportError Traceback (most recent call last)
<ipython-input-21-c3e03203b6fb> in <module>
----> 1 from simpletransformers.classification import MultiLabelClassificationModel
/opt/conda/lib/python3.6/site-packages/simpletransformers/classification/__init__.py in <module>
1 from simpletransformers.classification.classification_model import ClassificationModel
----> 2 from simpletransformers.classification.multi_label_classification_model import MultiLabelClassificationModel
3 from simpletransformers.classification.multi_modal_classification_model import MultiModalClassificationModel
/opt/conda/lib/python3.6/site-packages/simpletransformers/classification/multi_label_classification_model.py in <module>
6
7 from simpletransformers.classification import ClassificationModel
----> 8 from simpletransformers.custom_models.models import (
9 BertForMultiLabelSequenceClassification,
10 RobertaForMultiLabelSequenceClassification,
/opt/conda/lib/python3.6/site-packages/simpletransformers/custom_models/models.py in <module>
12 from transformers import FlaubertModel
13 from transformers.configuration_xlm_roberta import XLMRobertaConfig
---> 14 from transformers import ElectraForMaskedLM, ElectraForPreTraining
15 from torch.nn import BCEWithLogitsLoss
16
ImportError: cannot import name 'ElectraForMaskedLM'
To Reproduce
from simpletransformers.classification import MultiLabelClassificationModel
Expected behavior Successful Import
Desktop (please complete the following information):
- Ubuntu 16.04
- simpletransformers-0.24.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (4 by maintainers)
pip install --upgrade transformersYou need to update transformers as well, not just simpletransformers.
In kaggle environment
pip install --upgrade transformersresolve issue