You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Multi lingual models (both ner or pos) fails to load after download inside torch nn.
I don't have any problems with other ner packages
To Reproduce
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load("flair/ner-multi-fast")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/flair/flair/nn.py", line 93, in load
model = cls._init_model_with_state_dict(state)
File "/home/flair/flair/models/sequence_tagger_model.py", line 297, in _init_model_with_state_dict
model.load_state_dict(state["state_dict"])
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1037, in load_state_dict
load(self)
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1035, in load
load(child, prefix + name + '.')
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1035, in load
load(child, prefix + name + '.')
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1035, in load
load(child, prefix + name + '.')
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1031, in load
module._load_from_state_dict(
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 957, in _load_from_state_dict
for hook in self._load_state_dict_pre_hooks.values():
File "/root/anaconda3/envs/flair/lib/python3.9/site-packages/torch/nn/modules/module.py", line 778, in __getattr__
raise ModuleAttributeError("'{}' object has no attribute '{}'".format(
torch.nn.modules.module.ModuleAttributeError: 'LanguageModel' object has no attribute '_load_state_dict_pre_hooks'
tried on macos 11.1, python 3.8 and python 3.6 and 3.9.4
torch 1.7.1 (conda env from requirements)
Version flair 0.8.2 (I tried both pip install and pip from github repo)
The text was updated successfully, but these errors were encountered:
Describe the bug
Multi lingual models (both ner or pos) fails to load after download inside torch nn.
I don't have any problems with other ner packages
To Reproduce
The text was updated successfully, but these errors were encountered: