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 saving FlaubertTokenizer configs #14991

Merged

Conversation

vmaryasin
Copy link
Contributor

All specific tokenizer config properties must be passed to its base
class (XLMTokenizer) in order to be saved. This was not the case for
do_lowercase config. Thus it was not saved by save_pretrained() method
and saving and reloading the tokenizer changed its behaviour.

This commit fixes it.

What does this PR do?

Fixes # 14489

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@n1t0, @LysandreJik

Comment:

As I have said in the issue, a similar problem may happen to other models. For me, it is not obvious, that one should pass a model-specific config to the general base class constructor for the config to be saved later.

I feel like some comment should be left somewhere for future developers, but I cannot come up with a good place for it. On the other hand, maybe it is obvious from all the base class' descriptions, and I'm just not experienced enough.

All specific tokenizer config properties must be passed to its base
class (XLMTokenizer) in order to be saved. This was not the case for
do_lowercase config. Thus it was not saved by save_pretrained() method
and saving and reloading the tokenizer changed its behaviour.

This commit fixes it.
@LysandreJik LysandreJik requested a review from SaulLu January 6, 2022 15:13
Copy link
Contributor

@SaulLu SaulLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the fix! 🚀

Your PR made me realize that Flaubert didn't have any tests, that is terrible! If you're interested I'll open an issue soon to add the necessary tests for this tokenizer.

@SaulLu SaulLu merged commit 57b980a into huggingface:master Jan 11, 2022
@vmaryasin vmaryasin deleted the fix-flaubert-tokenizer-saving-config branch March 17, 2022 10:18
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