Skip to content

[Longformer] fix longformer global attention output#5659

Merged
patrickvonplaten merged 6 commits into
huggingface:masterfrom
patrickvonplaten:fix_longformer_output_attention_global
Jul 13, 2020
Merged

[Longformer] fix longformer global attention output#5659
patrickvonplaten merged 6 commits into
huggingface:masterfrom
patrickvonplaten:fix_longformer_output_attention_global

Conversation

@patrickvonplaten

@patrickvonplaten patrickvonplaten commented Jul 10, 2020

Copy link
Copy Markdown
Contributor

This PR fixes the attention probs that are outputted when longformer uses global attention and sets output_attention=True.

Thanks a million to @k141303 for very clean issue + perfect proposed solution in #5646 .

@patrickvonplaten patrickvonplaten linked an issue Jul 10, 2020 that may be closed by this pull request
4 tasks
@codecov

codecov Bot commented Jul 10, 2020

Copy link
Copy Markdown

Codecov Report

Merging #5659 into master will decrease coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5659      +/-   ##
==========================================
- Coverage   77.01%   76.87%   -0.14%     
==========================================
  Files         128      145      +17     
  Lines       21615    25369    +3754     
==========================================
+ Hits        16646    19502    +2856     
- Misses       4969     5867     +898     
Impacted Files Coverage Δ
src/transformers/__init__.py 99.24% <ø> (+0.11%) ⬆️
src/transformers/benchmark/benchmark.py 74.01% <ø> (+5.16%) ⬆️
src/transformers/benchmark/benchmark_args.py 86.04% <ø> (+0.68%) ⬆️
src/transformers/benchmark/benchmark_args_tf.py 87.50% <ø> (ø)
src/transformers/benchmark/benchmark_args_utils.py 89.13% <ø> (-7.75%) ⬇️
src/transformers/benchmark/benchmark_tf.py 61.53% <ø> (ø)
src/transformers/benchmark/benchmark_utils.py 69.84% <ø> (-3.26%) ⬇️
src/transformers/configuration_albert.py 100.00% <ø> (ø)
src/transformers/configuration_auto.py 93.18% <ø> (+0.32%) ⬆️
src/transformers/configuration_bart.py 93.75% <ø> (+0.41%) ⬆️
... and 118 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfacb2e...ee88c2f. Read the comment docs.

@patrickvonplaten patrickvonplaten changed the title [Longformer] fix longformer global attention output [WIP - don't merge yet][Longformer] fix longformer global attention output Jul 10, 2020
@patrickvonplaten patrickvonplaten changed the title [WIP - don't merge yet][Longformer] fix longformer global attention output [Longformer] fix longformer global attention output Jul 13, 2020
@patrickvonplaten

patrickvonplaten commented Jul 13, 2020

Copy link
Copy Markdown
Contributor Author

Global and Local attention probs have now always the same output shape. This is both more consistent in terms of the output signature for the user and solves the multi-gpu issue.

Comment thread src/transformers/modeling_longformer.py Outdated
@patrickvonplaten

Copy link
Copy Markdown
Contributor Author

Pinging @thomwolf @sshleifer @LysandreJik @sgugger for notification -> more details can be found in issue: #5646.

@patrickvonplaten
patrickvonplaten merged commit 7096e47 into huggingface:master Jul 13, 2020
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 this pull request may close these issues.

Can't get (global) attention probs using Longformer

1 participant