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
1e4a1913
Unverified
Commit
1e4a1913
authored
Oct 01, 2019
by
Thomas Wolf
Committed by
GitHub
Oct 01, 2019
Browse files
Merge pull request #1284 from slayton58/pooler_end_logits_fp16_fix
Fix fp16 masking in PoolerEndLogits
parents
6971556a
c50783e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
transformers/modeling_utils.py
transformers/modeling_utils.py
+4
-1
No files found.
transformers/modeling_utils.py
View file @
1e4a1913
...
...
@@ -501,7 +501,10 @@ class PoolerEndLogits(nn.Module):
x
=
self
.
dense_1
(
x
).
squeeze
(
-
1
)
if
p_mask
is
not
None
:
x
=
x
*
(
1
-
p_mask
)
-
1e30
*
p_mask
if
next
(
self
.
parameters
()).
dtype
==
torch
.
float16
:
x
=
x
*
(
1
-
p_mask
)
-
65500
*
p_mask
else
:
x
=
x
*
(
1
-
p_mask
)
-
1e30
*
p_mask
return
x
...
...
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