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
I'm trying to use this model. I even have an example from the site that doesn't work. Unknown error that I do not know how to solve. Please help or fix it
To Reproduce
fromflair.dataimportSentencefromflair.modelsimportSequenceTagger# load taggertagger=SequenceTagger.load("flair/ner-dutch-large")
# make example sentencesentence=Sentence("George Washington ging naar Washington")
# predict NER tagstagger.predict(sentence)
# print sentenceprint(sentence)
# print predicted NER spansprint('The following NER tags are found:')
# iterate over entities and printforentityinsentence.get_spans('ner'):
print(entity)
Expected behavior
Span [1,2]: "George Washington" [− Labels: PER (1.0)]
Span [5]: "Washington" [− Labels: LOC (1.0)]
Logs and Stack traces
Traceback (most recent call last):
File "/home/maksim/Development/pythonprojects/gpt_training.py", line 5, in <module>
tagger = SequenceTagger.load("flair/ner-dutch-large")
File "/home/maksim/.local/lib/python3.10/site-packages/flair/models/sequence_tagger_model.py", line 1035, in load
return cast("SequenceTagger", super().load(model_path=model_path))
File "/home/maksim/.local/lib/python3.10/site-packages/flair/nn/model.py", line 559, in load
return cast("Classifier", super().load(model_path=model_path))
File "/home/maksim/.local/lib/python3.10/site-packages/flair/nn/model.py", line 191, in load
state = load_torch_state(model_file)
File "/home/maksim/.local/lib/python3.10/site-packages/flair/file_utils.py", line 359, in load_torch_state
return torch.load(f, map_location="cpu")
File "/home/maksim/.local/lib/python3.10/site-packages/torch/serialization.py", line 1014, in load
return _load(opened_zipfile,
File "/home/maksim/.local/lib/python3.10/site-packages/torch/serialization.py", line 1422, in _load
result = unpickler.load()
File "/home/maksim/.local/lib/python3.10/site-packages/flair/embeddings/transformer.py", line 1169, in __setstate__
self.model.load_state_dict(model_state_dict)
File "/home/maksim/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 2152, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for XLMRobertaModel:
Unexpected key(s) in state_dict: "embeddings.position_ids".
Screenshots
No response
Additional Context
No response
Environment
Versions:
Flair
0.12.2
Pytorch
2.1.0+cu121
Transformers
4.34.1
GPU
False
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm trying to use this model. I even have an example from the site that doesn't work. Unknown error that I do not know how to solve. Please help or fix it
To Reproduce
Expected behavior
Span [1,2]: "George Washington" [− Labels: PER (1.0)]
Span [5]: "Washington" [− Labels: LOC (1.0)]
Logs and Stack traces
Screenshots
No response
Additional Context
No response
Environment
Versions:
Flair
0.12.2
Pytorch
2.1.0+cu121
Transformers
4.34.1
GPU
False
The text was updated successfully, but these errors were encountered: