-
Notifications
You must be signed in to change notification settings - Fork 31.6k
[Parakeet] add output_attention_mask #41694
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
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
|
||
| return BaseModelOutput(last_hidden_state=hidden_states) | ||
| return ParakeetEncoderModelOutput( | ||
| last_hidden_state=hidden_states, attention_mask=output_mask.int() if output_attention_mask else None |
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.
can we return lengths directly instead or along with attention_mask
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.
I'd rather keep an explicit approach here for potiential future usage of the same with left padding, you can retreive lengths by doing attention_mask.sum(-1)
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.
sounds good.
ArthurZucker
left a comment
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.
Okay sounds good !
|
[For maintainers] Suggested jobs to run (before merge) run-slow: parakeet |
* add output_attention_mask * style
* add output_attention_mask * style
What does this PR do?
Parakeet encoder modified the sequence length, making that the input attention_mask cannot be directly used to know which embeddings positions correspond to padding.
Here we do it differently than the actual external approach like we have on mimi that consists to retreive the correct mask:
and that recomputes as mask that is already known in the forward and that can simply be returned along with the outputs.