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

Import error after fresh install #12

Closed
kpister opened this issue Mar 5, 2021 · 3 comments
Closed

Import error after fresh install #12

kpister opened this issue Mar 5, 2021 · 3 comments

Comments

@kpister
Copy link

kpister commented Mar 5, 2021

I'm having some trouble installing trankit.

Created a new venv on python 3.8

$ pip install trankit
$ python
Python 3.8.6 (default, Oct 21 2020, 08:28:24)
[Clang 11.0.0 (clang-1100.0.33.12)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from trankit import Pipeline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "vtrankit/lib/python3.8/site-packages/trankit/__init__.py", line 1, in <module>
    from .pipeline import Pipeline
  File "vtrankit/lib/python3.8/site-packages/trankit/pipeline.py", line 2, in <module>
    from .models.base_models import Multilingual_Embedding
  File "vtrankit/lib/python3.8/site-packages/trankit/models/__init__.py", line 1, in <module>
    from .classifiers import *
  File "vtrankit/lib/python3.8/site-packages/trankit/models/classifiers.py", line 2, in <module>
    from .base_models import *
  File "vtrankit/lib/python3.8/site-packages/trankit/models/base_models.py", line 1, in <module>
    from transformers import AdapterType, XLMRobertaModel
  File "vtrankit/lib/python3.8/site-packages/transformers/__init__.py", line 672, in <module>
    from .trainer import Trainer
  File "vtrankit/lib/python3.8/site-packages/transformers/trainer.py", line 69, in <module>
    from .trainer_pt_utils import (
  File "vtrankit/lib/python3.8/site-packages/transformers/trainer_pt_utils.py", line 40, in <module>
    from torch.optim.lr_scheduler import SAVE_STATE_WARNING
ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler' (vtrankit/lib/python3.8/site-packages/torch/optim/lr_scheduler.py)

$ pip freeze
adapter-transformers==1.1.1
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
filelock==3.0.12
idna==2.10
joblib==1.0.1
numpy==1.20.1
packaging==20.9
protobuf==3.15.5
pyparsing==2.4.7
regex==2020.11.13
requests==2.25.1
sacremoses==0.0.43
sentencepiece==0.1.91
six==1.15.0
tokenizers==0.9.3
torch==1.8.0
tqdm==4.58.0
trankit==0.3.5
typing-extensions==3.7.4.3
urllib3==1.26.3

I've been looking around, the same error happened here. Not sure what is happening, but seems like my pytorch version is too new? The setup.py for trankit specifies torch>=1.6.1.

@kpister
Copy link
Author

kpister commented Mar 5, 2021

I used a fresh install to get around the issue linked here, since that was the issue I ran into on my default venv.

@kpister
Copy link
Author

kpister commented Mar 5, 2021

Resolved. Looks like it was an issue with the adapter-transformers library. The version 1.1.1 is broken with trankit but 1.0.1 is functional. You can force the version install with setup.py if others have this issue too.

@minhhdvn
Copy link
Collaborator

minhhdvn commented Mar 6, 2021

Hi @kpister,
Thank you for letting us know.
You're right that the import error came from the version 1.1.1 of the adapter-transformers. We have specified the version 1.0.1 for the adapter-transformers for installing trankit. The new version of trankit that fixed this problem is 0.3.6.
Thanks.

@kpister kpister closed this as completed Mar 6, 2021
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

2 participants