Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6a346f03
Unverified
Commit
6a346f03
authored
Jan 21, 2021
by
Muennighoff
Committed by
GitHub
Jan 21, 2021
Browse files
fix typo (#9708)
* fix typo Co-authored-by:
Suraj Patil
<
surajp815@gmail.com
>
parent
4a20b7c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_tf_utils.py
src/transformers/modeling_tf_utils.py
+1
-1
No files found.
src/transformers/modeling_tf_utils.py
View file @
6a346f03
...
...
@@ -147,7 +147,7 @@ class TFCausalLanguageModelingLoss:
loss_fn
=
tf
.
keras
.
losses
.
SparseCategoricalCrossentropy
(
from_logits
=
True
,
reduction
=
tf
.
keras
.
losses
.
Reduction
.
NONE
)
# make sure only labels that are not equal to -100
do not
affect loss
# make sure only labels that are not equal to -100 affect
the
loss
active_loss
=
tf
.
not_equal
(
tf
.
reshape
(
labels
,
(
-
1
,)),
-
100
)
reduced_logits
=
tf
.
boolean_mask
(
tf
.
reshape
(
logits
,
(
-
1
,
shape_list
(
logits
)[
2
])),
active_loss
)
labels
=
tf
.
boolean_mask
(
tf
.
reshape
(
labels
,
(
-
1
,)),
active_loss
)
...
...
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