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

Warning about too long input for fast tokenizers too #8799

Merged
merged 5 commits into from
Dec 2, 2020

Conversation

Narsil
Copy link
Contributor

@Narsil Narsil commented Nov 26, 2020

What does this PR do?

If truncation is not set in tokenizers, but the tokenization is too long
for the model (model_max_length), we used to trigger a warning that

The input would probably fail (which it most likely will).

This PR re-enables the warning for fast tokenizers too and uses common code
for the trigger to make sure it's consistent across.

Fixes # (issue)

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 which may be interested in your PR.

@LysandreJik
@thomwolf

@Narsil Narsil requested review from thomwolf and LysandreJik and removed request for thomwolf November 26, 2020 12:57
@Narsil
Copy link
Contributor Author

Narsil commented Nov 26, 2020

Failing tests seem to come from some other code (seq2seq)

Comment on lines 3165 to 3170
"""
Clean up a list of simple English tokenization artifacts like spaces before punctuations and abbreviated forms.
clean up a list of simple english tokenization artifacts like spaces before punctuations and abbreviated forms.

Args:
out_string (:obj:`str`): The text to clean up.
args: out_string (:obj:`str`): the text to clean up.

Returns:
:obj:`str`: The cleaned-up string.
returns: :obj:`str`: the cleaned-up string.
Copy link
Member

Choose a reason for hiding this comment

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

The docstring was in the correct style before the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I simply ran the documentation fixer :(

@LysandreJik
Copy link
Member

@thomwolf could you review this PR as you're the mastermind behind this code?

@LysandreJik LysandreJik requested a review from thomwolf November 27, 2020 17:38
Copy link
Member

@thomwolf thomwolf left a comment

Choose a reason for hiding this comment

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

LGTM

If truncation is not set in tokenizers, but the tokenization is too long
for the model (`model_max_length`), we used to trigger a warning that

The input would probably fail (which it most likely will).

This PR re-enables the warning for fast tokenizers too and uses common
code for the trigger to make sure it's consistent across.
@Narsil Narsil force-pushed the warning_for_too_long_input branch from 201db80 to a4ecb3a Compare December 2, 2020 10:04
@Narsil
Copy link
Contributor Author

Narsil commented Dec 2, 2020

@LysandreJik May I merge (failing tests and quality is linked to unrelated finetune.py code, I tried to rebase but it does not seem to be enough)

@LysandreJik LysandreJik merged commit a8c3f9a into huggingface:master Dec 2, 2020
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.

3 participants