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
274d850d
Commit
274d850d
authored
May 08, 2020
by
Julien Chaumond
Browse files
Fix #4098
parent
26dad0a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_gpt2.py
src/transformers/modeling_gpt2.py
+1
-1
No files found.
src/transformers/modeling_gpt2.py
View file @
274d850d
...
@@ -145,7 +145,7 @@ class Attention(nn.Module):
...
@@ -145,7 +145,7 @@ class Attention(nn.Module):
w
=
w
/
(
v
.
size
(
-
1
)
**
0.5
)
w
=
w
/
(
v
.
size
(
-
1
)
**
0.5
)
nd
,
ns
=
w
.
size
(
-
2
),
w
.
size
(
-
1
)
nd
,
ns
=
w
.
size
(
-
2
),
w
.
size
(
-
1
)
mask
=
self
.
bias
[:,
:,
ns
-
nd
:
ns
,
:
ns
]
mask
=
self
.
bias
[:,
:,
ns
-
nd
:
ns
,
:
ns
]
w
=
torch
.
where
(
mask
,
w
,
self
.
masked_bias
)
w
=
torch
.
where
(
mask
,
w
,
self
.
masked_bias
.
to
(
w
.
dtype
)
)
if
attention_mask
is
not
None
:
if
attention_mask
is
not
None
:
# Apply the attention mask
# Apply the attention mask
...
...
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