question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name 'ElectraForMaskedLM'

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
salil-gtmcommented, Apr 12, 2020

pip install --upgrade transformers

2reactions
ThilinaRajapaksecommented, Apr 10, 2020

You need to update transformers as well, not just simpletransformers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name 'LayoutLMv3Processor' from ...
I am getting following error in huggingface sagemaker. ImportError: cannot import name 'LayoutLMv3Processor' from 'transformers' ...
Read more >
How to resolve the hugging face error ImportError: cannot ...
I was trying to use the ViTT transfomer. I got the following error with code: from pathlib import Path import torchvision from typing...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
ImportError: cannot import name 'dtensor' - Jetson Nano
Hello Guys, I just got a Jetson Nano and created my SD-Card with Jetpack 4.6.1. After that I installed TensorFlow like this: ...
Read more >
ImportError: cannot import name 'PetroskiSuchModel'
the following configuration is deepchem=2.4.0 rc ,tensorfow :2.3.0 python :3.6.5,rkdit:2020.09.1.0,why ?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found