The sentiment analysis pipeline is not working and returns the following error. I saw that you have set different filename for the model (GH-1841: fix sentiment model for transformers 3.1 ) but it hasn't been pushed to pip install flair.
Until this is updated to pip, can you please guide me how to install flair using the git repository?
/usr/local/lib/python3.6/dist-packages/transformers/configuration_utils.py in use_return_dict(self)
217 """
218 # If torchscript is set, force return_dict=False to avoid jit errors
--> 219 return self.return_dict and not self.torchscript
220
221 @property
AttributeError: 'DistilBertConfig' object has no attribute 'return_dict'
You can install from master using this command:
~
pip install --upgrade git+https://github.com/flairNLP/flair.git
~
Thanks, closing the issue
For the same Issue i am getting the following error even after downloading flair from master copy:
classifier = TextClassifier.load('en-sentiment')
2020-09-09 20:31:30,937 https://nlp.informatik.hu-berlin.de/resources/models/sentiment-curated-distilbert/sentiment-en-mix-distillbert_3.1.pt not found in cache, downloading to C:\Users\nidut\AppData\Local\Temp\tmpg4qk62lx
100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻坾 266147697/266147697 [18:33<00:00, 238942.00B/s]
2020-09-09 20:50:05,633 copying C:\Users\nidut\AppData\Local\Temp\tmpg4qk62lx to cache at C:\Users\nidut\.flair\models\sentiment-en-mix-distillbert_3.1.pt
2020-09-09 20:50:06,118 removing temp file C:\Users\nidut\AppData\Local\Temp\tmpg4qk62lx
2020-09-09 20:50:06,153 loading file C:\Users\nidut\.flair\models\sentiment-en-mix-distillbert_3.1.pt
---------------------------------------------------------------------------
UnpicklingError Traceback (most recent call last)
<ipython-input-3-f517a501f1cf> in <module>
----> 1 classifier = TextClassifier.load('en-sentiment')
d:\python\lib\site-packages\flair\nn.py in load(cls, model)
86 # see https://github.com/zalandoresearch/flair/issues/351
87 f = file_utils.load_big_file(str(model_file))
---> 88 state = torch.load(f, map_location='cpu')
89
90 model = cls._init_model_with_state_dict(state)
d:\python\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
424 if sys.version_info >= (3, 0) and 'encoding' not in pickle_load_args.keys():
425 pickle_load_args['encoding'] = 'utf-8'
--> 426 return _load(f, map_location, pickle_module, **pickle_load_args)
427 finally:
428 if new_fd:
d:\python\lib\site-packages\torch\serialization.py in _load(f, map_location, pickle_module, **pickle_load_args)
601 f.seek(0)
602
--> 603 magic_number = pickle_module.load(f, **pickle_load_args)
604 if magic_number != MAGIC_NUMBER:
605 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
Most helpful comment
You can install from master using this command:
~pip install --upgrade git+https://github.com/flairNLP/flair.git
~