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
9ffda216
Commit
9ffda216
authored
Oct 03, 2019
by
Simon Layton
Browse files
Fix missed head transpose
parent
d51b5894
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
transformers/modeling_xlnet.py
transformers/modeling_xlnet.py
+1
-1
No files found.
transformers/modeling_xlnet.py
View file @
9ffda216
...
@@ -284,7 +284,7 @@ class XLNetRelativeAttention(nn.Module):
...
@@ -284,7 +284,7 @@ class XLNetRelativeAttention(nn.Module):
# Mask heads if we want to
# Mask heads if we want to
if
head_mask
is
not
None
:
if
head_mask
is
not
None
:
attn_prob
=
attn_prob
*
head_mask
attn_prob
=
attn_prob
*
torch
.
einsum
(
'ijbn->bnij'
,
head_mask
)
# attention output
# attention output
attn_vec
=
torch
.
einsum
(
'bnij,jbnd->ibnd'
,
attn_prob
,
v_head_h
)
attn_vec
=
torch
.
einsum
(
'bnij,jbnd->ibnd'
,
attn_prob
,
v_head_h
)
...
...
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