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

🐛 Bug in attention head mask for cross-attention module in encoder-decoder models #10540

Closed
stancld opened this issue Mar 5, 2021 · 3 comments · Fixed by #10605
Closed

Comments

@stancld
Copy link
Contributor

stancld commented Mar 5, 2021

Currently, encoder-decoder models use either head_mask or decoder_head_mask for masking attention heads in cross-attention modules. Both cases are not perfectly correct. Furthermore, MHA in cross-attention modules shares the parameters with the decoder, i.e. shape = (decoder.num_layers, decoder.num_attention_heads), therefore, the usage of encoder head_mask in the cross-attention module may lead to errors due to the shape mismatch.


My contribution: I will take care of this issue this weekend.


Reviewers: @patil-suraj @patrickvonplaten

@stancld stancld changed the title 🐛 Fix attention head mask for cross-attention module in encoder-decoder models 🐛 Bug in attention head mask for cross-attention module in encoder-decoder models Mar 5, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@patil-suraj
Copy link
Contributor

Unstale

@patrickvonplaten
Copy link
Contributor

Hey @stancld,

Sorry for being so unresponsive here - I'm happy to change the behavior and provide 3 masks

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 a pull request may close this issue.

3 participants