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

Fix bug saving embeddings #3564

Closed

Conversation

jeffpicard
Copy link
Contributor

Hi! I have a one-liner fix suggestion.

I get the following error when running relatively straightforward scripts:

    embeddings.save_embeddings(use_state_dict=False)
  File "/code/flair/flair/embeddings/base.py", line 101, in save_embeddings
    params = self.to_params()
             ^^^^^^^^^^^^^^^^
  File "/code/flair/flair/embeddings/transformer.py", line 1359, in to_params
    del config_dict["_attn_implementation_autoset"]
        ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '_attn_implementation_autoset'

Here's a minimal reproduction of the bug:

from flair.embeddings import TransformerDocumentEmbeddings
embeddings = TransformerDocumentEmbeddings(model="distilbert-base-uncased")
embeddings.save_embeddings()

This fails on master but succeeds on this branch.

I think this accidentally came in from this recent PR.

@jeffpicard
Copy link
Contributor Author

@helpmefindaname what do you think?

@stefan-it
Copy link
Member

stefan-it commented Nov 16, 2024

I can confirm this bug when fine-tuning e.g. BERT-based models - and this PR fixes it, many thanks @jeffpicard !

stefan-it added a commit to stefan-it/turkish-bert that referenced this pull request Nov 16, 2024
@jeffpicard
Copy link
Contributor Author

Oh great, and thank you both for fixing the CI error in #3565.

Although it looks like the download page is back up. So CI should pass on this branch if you rerun it and that PR may no longer be necessary.

@jeffpicard
Copy link
Contributor Author

This diff was included in PR #3548 which merged, making this PR unnecessary. Closing.

@jeffpicard jeffpicard closed this Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants