Add head_mask and decoder_head_mask to TF LED#9988
Merged
LysandreJik merged 4 commits intohuggingface:masterfrom Feb 9, 2021
Merged
Add head_mask and decoder_head_mask to TF LED#9988LysandreJik merged 4 commits intohuggingface:masterfrom
LysandreJik merged 4 commits intohuggingface:masterfrom
Conversation
sgugger
approved these changes
Feb 4, 2021
Collaborator
sgugger
left a comment
There was a problem hiding this comment.
LGTM, thanks for adding this!
| # compute global attn probs | ||
| global_attn_probs_float = tf.nn.softmax(global_attn_scores, axis=-1) | ||
|
|
||
| # apply layer head maskin |
Contributor
There was a problem hiding this comment.
Suggested change
| # apply layer head maskin | |
| # apply layer head masking |
patrickvonplaten
approved these changes
Feb 8, 2021
Contributor
patrickvonplaten
left a comment
There was a problem hiding this comment.
Looks great! Awesome that you've added the head masking also for both the local and global attention. Longformer is a tricky model so great job!
jplu
approved these changes
Feb 9, 2021
Contributor
jplu
left a comment
There was a problem hiding this comment.
LGTM! Thanks a lot for the great work on this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements
head_maskanddecoder_head_maskfor TF LED (and Longformer as there's a copy dependency) and it is the follow-up to the open issue #9814.Motivation: This PR is a part of an endeavour to enable the usage of
head_maskanddecoder_head_maskfor all encoder-decoder transformers following the recent work on BART-like models (#9639).Fixes: #9814
Reviewers: @jplu @patrickvonplaten @LysandreJik @sgugger