Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: cannot load 'de-pos-fine-grained' #3237

Open
LydiaKoerber opened this issue May 12, 2023 · 6 comments
Open

[Bug]: cannot load 'de-pos-fine-grained' #3237

LydiaKoerber opened this issue May 12, 2023 · 6 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@LydiaKoerber
Copy link

Describe the bug

Hi!
I tried to use the fine-grained PoS-Tagger for German Twitter data described here, but unfortunately, I ran into an error trying to load the model. Is this model still included in flair?
Otherwise, can you recommend another fine-grained flair model for PoS-tagging for German (apart from basic de-pos)?
Many thanks in advance!

To Reproduce

import flair
model = flair.models.SequenceTagger.load('de-pos-fine-grained')

Expected behavior

no error?

Logs and Stack traces

Repository Not Found for url: https://huggingface.co/de-pos-fine-grained/resolve/main/pytorch_model.bin.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
Invalid username or password.

Screenshots

No response

Additional Context

No response

Environment

@LydiaKoerber LydiaKoerber added the bug Something isn't working label May 12, 2023
@helpmefindaname
Copy link
Collaborator

Hello @LydiaKoerber ,
Looking at the commit history, I think it was only added for version 4 but never got merged into master (and therefore isn't there for any future versions).

The model is in a old version and I will talk to @alanakbik to provide an uptodate version.

In the meantime you can download the model from https://nlp.informatik.hu-berlin.de/resources/models/de-pos-tweets/de-pos-twitter-v0.1.pt when loading the model, you need to add some simple fix:

tagger = SequenceTagger.load("de-pos-twitter.pt")  # the downloaded model
tagger.embeddings.embeddings[1].chars_per_chunk=512  # add a missing value not stored in the model
tagger.embeddings.embeddings[2].chars_per_chunk=512

@alanakbik
Copy link
Collaborator

If I remember correctly, this model was actually trained by @stefan-it.

@stefan-it
Copy link
Member

stefan-it commented May 15, 2023

Ah, so we could upload the model to the Model Hub?

@stefan-it
Copy link
Member

Hi @LydiaKoerber ,

after conversation with @alanakbik we decided that it would be better to have a re-trained version on the model hub, because lot of internal modules in the model are pretty depracted and outdated (For example CharLMEmbeddings, whereas FlairEmbeddings should be used now).

So I re-trained the model and documented it here.

I also uploaded the new model to the Hugging Face Model Hub - demo usage with latest Flair version:

from flair.data import Sentence
from flair.models import SequenceTagger

model = SequenceTagger.load('flair/de-pos-fine-grained')
sent = Sentence("@Sneeekas Ich nicht \o/", use_tokenizer=False)
model.predict(sent)

print(sent)

this should correctly return:

Sentence[4]: "@Sneeekas Ich nicht \o/" → ["@Sneeekas"/ADDRESS, "Ich"/PPER, "nicht"/PTKNEG, "\o/"/EMO]

I will prepare PR for Flair (documentation update) and model card on the Model Hub soon!

@LydiaKoerber
Copy link
Author

Great, thanks a lot!

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants