-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Show a warning for missing attention masks when pad_token_id is not None #24510
Conversation
156a9a6
to
d007683
Compare
6492be3
to
e286374
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR but I'm not in favor of this. There are a lot of false positives this is going to generate: an attention mask should be passed if there are any tokens in the inputs that are the pad token. It's not necessary to pass one just because the model has a pad token ID.
Thanks for the review. Would it be better to check for the presence of the pad_token_id inside input_ids first before throwing the error, as per |
2afcd03
to
6993429
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for iterating, I think it's better this way. Let's jsut reuse the warning_once
API we have.
Thanks, I've updated the code accordingly. |
These warning messages when there are pad tokens within the input ids and no attention masks are given. The warning message should only show up once.
These warning messages are shown when the pad_token_id is not None and no attention masks are given. The warning message should only show up once.
…nd with pad tokens
2bdaa09
to
da850a1
Compare
@gante could you have a second look here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice comprehensive warning, I like it! 🔥
The documentation is not available anymore as the PR was closed or merged. |
@hackyon Thank you for the contribution! Would you like to add it to the remaining models? 🤗 |
Sure, I'll look into it 👍 |
Thanks @ydshieh for fixing the flaky test! I was busy in July, but will now add the warning to more models over the next couple of days. |
What does this PR do?
Fixes #16136
Shows a one-time warning message when the pad_token_id is not None and no attention masks are given.
Before submitting
Pull Request section?
input_ids
that include padding tokens, but noattention_mask
is provided. #16136documentation guidelines, and
here are tips on formatting docstrings.
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.
@gante @ydshieh