Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'LongformerModel' from 'transformers' (transformers=2.8) #11

Open
y0uCeF opened this issue Dec 19, 2020 · 0 comments

Comments

@y0uCeF
Copy link

y0uCeF commented Dec 19, 2020

I had an issue running the code after installing the required transformers==2.8 and sentencepiece==0.1.85. I got the error:

Traceback (most recent call last):
  File "train_ditto.py", line 90, in <module>
    from snippext.mixda import initialize_and_train
  File "Snippext_public/snippext/mixda.py", line 13, in <module>
    from .model import MultiTaskNet
  File "Snippext_public/snippext/model.py", line 3, in <module>
    from transformers import BertModel, AlbertModel, DistilBertModel, RobertaModel, XLNetModel, LongformerModel
ImportError: cannot import name 'LongformerModel' from 'transformers' (/home/youcef/.conda/envs/py37/lib/python3.7/site-packages/transformers/__init__.py)

I fixed it by installing transformers==3.1 instead, which introduced LongformerModel.

I recommend the requirements should be updated accordingly.

transformers==2.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant