MaartenGr / PolyFuzz

Fuzzy string matching, grouping, and evaluation.
https://maartengr.github.io/PolyFuzz/
MIT License
733 stars 67 forks source link

ImportError: cannot import name 'OneCycleLR' from 'torch.optim.lr_scheduler' #7

Closed nxnixin closed 3 years ago

nxnixin commented 3 years ago

Hi, really thanks for your amazing library firstly.

I got an error when I run " from polyfuzz import PolyFuzz" and I have installed all of the requirements. I could not run your library due to this error.

/Users/nixin/anaconda3/bin/python /Users/nixin/PycharmProjects/run.py Traceback (most recent call last): File "/Users/nixin/PycharmProjects/test_similarity/run.py", line 8, in from polyfuzz import PolyFuzz File "/Users/nixin/anaconda3/lib/python3.7/site-packages/polyfuzz/init.py", line 1, in from .polyfuzz import PolyFuzz File "/Users/nixin/anaconda3/lib/python3.7/site-packages/polyfuzz/polyfuzz.py", line 7, in from polyfuzz.models import TFIDF, RapidFuzz, Embeddings, BaseMatcher File "/Users/nixin/anaconda3/lib/python3.7/site-packages/polyfuzz/models/init.py", line 10, in from ._embeddings import Embeddings File "/Users/nixin/anaconda3/lib/python3.7/site-packages/polyfuzz/models/_embeddings.py", line 8, in from flair.embeddings import DocumentPoolEmbeddings, WordEmbeddings, TokenEmbeddings File "/Users/nixin/anaconda3/lib/python3.7/site-packages/flair/init.py", line 22, in from . import trainers File "/Users/nixin/anaconda3/lib/python3.7/site-packages/flair/trainers/init.py", line 1, in from .trainer import ModelTrainer File "/Users/nixin/anaconda3/lib/python3.7/site-packages/flair/trainers/trainer.py", line 33, in from torch.optim.lr_scheduler import OneCycleLR ImportError: cannot import name 'OneCycleLR' from 'torch.optim.lr_scheduler' (/Users/anaconda3/lib/python3.7/site-packages/torch/optim/lr_scheduler.py)

My PyTorch version is 1.2.0.

Do you know what's the reason caused this? I appreciate any suggestions. Thanks in advance.

MaartenGr commented 3 years ago

Can you try it in a fresh conda env? Does the problem then still persist?

I just tried it out in a fresh google colab session and I am not getting that issue.

nxnixin commented 3 years ago

Can you try it in a fresh conda env? Does the problem then still persist?

I just tried it out in a fresh google colab session and I am not getting that issue.

I found it works on jupyternotebook. It seems flair library has an issue on my pycharm env. It is weird. But thanks anyway. I need to check more.