Manash
Manash

Reputation: 11

Unable to load a model from hugging face

Was using this POS tagging model few moths ago with no issues. Recently tried again , but the model is not loading. Please help!!!!!!!

Tried to load the model, but diplaying the same error. Tried with the latest version of flair and also the flair version specified

Model link: https://huggingface.co/dpathak/aspos_assamese_pos_tagger.

Error

Upvotes: 0

Views: 449

Answers (1)

ProBuro
ProBuro

Reputation: 58

It's not very clear how you load the model. Try downloading the files

Judging by the screenshot, you have one layer or an extra layer in your loaded weight (which may well be the case if the model has been changed, in which case you need to find the model page on GitHub. The authors of the model can post a new weight if they haven’t managed to add it to HF).

The following method allows you to load weight without the problematic layer. Since you have only one, it probably won’t be critical (you need to check it in practice). It’s easy to do.

model.load_state_dict(state_dict, strict=False)

strict should solve the problem

You can create your own model instance with the correct layer names. Take the model code from the old version of the library. The old weights should fit into the old version. In any case, I hope my answer helps you

Upvotes: 0

Related Questions