Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
b1e1a9f9
Unverified
Commit
b1e1a9f9
authored
Jan 10, 2020
by
Thomas Wolf
Committed by
GitHub
Jan 10, 2020
Browse files
Merge pull request #2495 from mschrimpf/patch-1
T5: move rp_bucket to relative_attention_bias' device
parents
331065e6
90d3b787
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
src/transformers/modeling_t5.py
src/transformers/modeling_t5.py
+1
-0
No files found.
src/transformers/modeling_t5.py
View file @
b1e1a9f9
...
...
@@ -286,6 +286,7 @@ class T5Attention(nn.Module):
bidirectional
=
not
self
.
is_decoder
,
num_buckets
=
self
.
relative_attention_num_buckets
,
)
rp_bucket
=
rp_bucket
.
to
(
self
.
relative_attention_bias
.
weight
.
device
)
values
=
self
.
relative_attention_bias
(
rp_bucket
)
# shape (qlen, klen, num_heads)
values
=
values
.
permute
([
2
,
0
,
1
]).
unsqueeze
(
0
)
# shape (1, num_heads, qlen, klen)
return
values
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment