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

Value Error when importing blurr.modeling.all and blurr.data.all #21

Closed
JeremyOBrien16 opened this issue Dec 6, 2020 · 15 comments
Closed

Comments

@JeremyOBrien16
Copy link

After pip install in Colab, import blurr.modeling.all and blurr.data.all are throwing errors. Did not encounter errors last week, not sure when they began. Has there been a syntax change for setup?


ValueError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/range.py in get_loc(self, key, method, tolerance)
354 try:
--> 355 return self._range.index(new_key)
356 except ValueError as err:

ValueError: 1 is not in range

The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last)
6 frames
in ()
----> 1 from blurr.modeling.all import *

/usr/local/lib/python3.6/dist-packages/blurr/modeling/all.py in ()
----> 1 from ..utils import *
2 from .core import *
3 from .question_answering import *
4 from .token_classification import *
5 from .text2text.core import *

/usr/local/lib/python3.6/dist-packages/blurr/utils.py in ()
182
183 # Cell
--> 184 BLURR_MODEL_HELPER = ModelHelper()
185
186 # Cell

/usr/local/lib/python3.6/dist-packages/blurr/utils.py in call(self, *args, **kwargs)
25
26 def call(self, *args, **kwargs):
---> 27 if self._instance == None: self._instance = self._cls(*args, **kwargs)
28 return self._instance
29

/usr/local/lib/python3.6/dist-packages/blurr/utils.py in init(self)
59 model_type_df = self._df[(self._df.functional_area == 'modeling')].class_name.str.split('For', n=1, expand=True)
60
---> 61 model_type_df[1] = np.where(model_type_df[1].notnull(),
62 'For' + model_type_df[1].astype(str),
63 model_type_df[1])

/usr/local/lib/python3.6/dist-packages/pandas/core/frame.py in getitem(self, key)
2904 if self.columns.nlevels > 1:
2905 return self._getitem_multilevel(key)
-> 2906 indexer = self.columns.get_loc(key)
2907 if is_integer(indexer):
2908 indexer = [indexer]

/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/range.py in get_loc(self, key, method, tolerance)
355 return self._range.index(new_key)
356 except ValueError as err:
--> 357 raise KeyError(key) from err
358 raise KeyError(key)
359 return super().get_loc(key, method=method, tolerance=tolerance)

KeyError: 1

@LR-Silva
Copy link

LR-Silva commented Dec 7, 2020

Same error here. It was working fine last week and now I cannot import.

@ohmeow
Copy link
Owner

ohmeow commented Dec 7, 2020

I'll take a look ... either something in fastai or huggingface has changed. What versions of each are you both working with?

@LR-Silva
Copy link

LR-Silva commented Dec 8, 2020

I tried both the default version from pypi (0.0.18) or installing from source (0.0.19) with pip install -e ".[dev]".
I got the same error when using on Colab and on my personal machine with both versions.

@JeremyOBrien16
Copy link
Author

Thanks for the quick response!

fastai 1.0.61
transformers 4.0.0

@JeremyOBrien16
Copy link
Author

Looks like huggingface pushed a transformers update a week ago: https://github.com/huggingface/transformers/releases

@JeremyOBrien16
Copy link
Author

Rolled back to transformer==3.5.1 and install / imports working fine.

@ohmeow
Copy link
Owner

ohmeow commented Dec 8, 2020 via email

@LR-Silva
Copy link

LR-Silva commented Dec 8, 2020

It worked here for me.
Thanks 👍

@tyoc213
Copy link

tyoc213 commented Dec 8, 2020

It worked here for me.
Thanks +1

How?

For me is still failing?... well, installed from pip

python        : 3.8.5
fastai        : 2.1.8
fastprogress  : 0.2.7
torch         : 1.7.0
transformers  : 3.5.1

Oh yeah, it works with


Thx
pip install transformers==3.5.1 
pip install ohmeow-blurr==0.0.18

@HenryDashwood
Copy link
Contributor

It's actually quite an easy fix I think. Huggingface have just buried their model files in a couple of extra layers of directories since the src folder was getting quite big. So in ModelHelper's __init__() you need to split self._df.module_part_3 instead of self._df.module_part_1. I got it to work on my fork here: https://github.com/HenryDashwood/blurr/commit/dececd4e706129694b25ee80c15dfb61ffadf9a9#diff-45d6eb3657aeaa14c3dacc16d9278dda8d6aa21c61456f9a03d80e34d368eeec

Unfortunately there are a few more version 4 breaking changes which come up when I try to test the notebooks. I might have some time to take a crack at them this week if it would be helpful?

@ohmeow
Copy link
Owner

ohmeow commented Dec 13, 2020

Done.

The latest fast.ai and transformers libs actually broke a few things ... but all is working now; all tests are passing.

Closing this out ... lmk if anything is still broken for you all.

@ohmeow ohmeow closed this as completed Dec 13, 2020
@bappctl
Copy link

bappctl commented Apr 13, 2022

[Works fine with]
python: 3.7.13
pytorch: 1.7.1+cu110
fastai: 2.2.5
transformers: 4.3.3
ohmeow-blurr==0.0.24

and to use BLURR_MODEL_HELPER. instead of BLURR.

@ohmeow
Copy link
Owner

ohmeow commented Apr 13, 2022

@bappctl : try installing the latest version of blurr ... pip install ohmeow-blurr==1.0.2

There were some of the old imports being cached in there that nbdev didn't clear out when I made the initial release. That's been fixed and the namespaces have changed. All the NLP/Text bits will be under blurr.text.

Feel free to close this out once things are working (or lmk if you are still having issues).

@ohmeow ohmeow reopened this Apr 13, 2022
@waisyousofi
Copy link

waisyousofi commented Apr 29, 2022

You are right ,

ohmeow-blurr==0.0.24
and
BLURR_MODEL_HELPER instead of BLURR

worked for me.

thanks✌️

@ohmeow
Copy link
Owner

ohmeow commented May 11, 2022

Closing this out as v.1 is out and the code above is obsolete.

@ohmeow ohmeow closed this as completed May 11, 2022
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

7 participants