-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
[Generate] correct encoder_outputs are passed without attention_mask #14980
[Generate] correct encoder_outputs are passed without attention_mask #14980
Conversation
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 fixing!
tests/test_generation_utils.py
Outdated
output_sequences_with_mask = model.generate( | ||
encoder_outputs=encoder_outputs, attention_mask=attention_mask | ||
).cpu() |
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.
As usual, when formatted like this by black, I'd go for two lines :-)
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.
LGTM
The wav2vec2 doesn't seem to belong, if it does maybe a test should explain what the test is actually about.
framework="pt", | ||
) | ||
|
||
ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation").sort("id") |
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.
Is the sort necessary ?
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.
yeah since it different versions datasets might break the order
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 seems like a very odd thing in datasets
that order could be messed up by subsequent versions...
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.
@anton-l and I have experienced this now a couple of times so tat we'll just make sure this way
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.
Good to know !
…ckvonplaten/transformers into correct_generate_edge_case
…uggingface#14980) * [Generate] correct encoder_outputs are passed without attention_mask * Apply suggestions from code review * up
What does this PR do?
Very very edge case is solved in this PR which occurs if
"encoder_outputs"
is passed in combination without passing"attention_mask"
, but a model that accepts an"attention_mask"
.Before submitting
Pull Request section?
to it if that's the case.
documentation 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.