RuntimeError when trying to load model with flair.
#2
by
rkoynov
- opened
from flair.models import SequenceTagger
tagger = SequenceTagger.load("stefan-it/hmbench-ajmc-en-hmbert-bs8-wsFalse-e10-lr5e-05-poolingfirst-layers-1-crfFalse-2")
raises a RuntimeError:
RuntimeError: Error(s) in loading state_dict for SequenceTagger: size mismatch for embeddings.model.embeddings.word_embeddings.weight: copying a param with shape torch.Size([32001, 768]) from checkpoint, the shape in current model is torch.Size([32002, 768]).
Other models work fine in my environment. Any idea what might be causing this?
Hi @rkoynov ,
many thanks for reporting that issue!
I created an issue at Flair upstream repo to track this: https://github.com/flairNLP/flair/issues/3419
In the meantime you can locally fix that issue by installing flair in a specific commit revision:
pip3 install git+https://github.com/flairNLP/flair.git@42ea3f6854eba04387c38045f160c18bdaac07dc
Thanks a lot for the prompt reply! The model works with the flair version you provided.