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

Fixed inconsistency in several fast tokenizers #26561

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Fixed inconsistency in several fast tokenizers #26561

merged 1 commit into from
Oct 6, 2023

Conversation

Towdo
Copy link
Contributor

@Towdo Towdo commented Oct 3, 2023

Fixed case where behavior of BertTokenizer and BertTokenizerFast is different.
An empty list will be evaluated to False but not to is None.

(I mistakenly closed my first merge request)

Fixes #26123

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?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@ArthurZucker

Copy link
Collaborator

@ArthurZucker ArthurZucker 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 these changes! Let's add a small test in the test_tokenization_common 😉

@Towdo
Copy link
Contributor Author

Towdo commented Oct 5, 2023

Thanks a lot for these changes! Let's add a small test in the test_tokenization_common 😉

I changed the test_build_inputs_with_special_tokens to test this edge case :)

@ArthurZucker
Copy link
Collaborator

Thanks 😉

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Very good thanks, I would just like 1 hard coded expected value, otherwise if both are broken we are not testing anything! Thanks for the fix

@Towdo
Copy link
Contributor Author

Towdo commented Oct 5, 2023

Very good thanks, I would just like 1 hard coded expected value, otherwise if both are broken we are not testing anything! Thanks for the fix

Can you give me some guidance on how to do this?
Because the behaviour differs from tokenizer to tokenizer, I can't/shouldn't do it in test_tokenization_common, right?
So instead I hard code one test in each test_tokenization_(tokenizer)?

@ArthurZucker
Copy link
Collaborator

Oups my bad on this one!
It's alright like this 😉 I'll merge

@ArthurZucker ArthurZucker merged commit af38c83 into huggingface:main Oct 6, 2023
20 checks passed
helboukkouri pushed a commit to helboukkouri/transformers that referenced this pull request Oct 16, 2023
blbadger pushed a commit to blbadger/transformers that referenced this pull request Nov 8, 2023
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 18, 2023
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.

Inconsistency in BertFastTokenizer
2 participants