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
7e56ba28
Unverified
Commit
7e56ba28
authored
Jan 31, 2022
by
Matt
Committed by
GitHub
Jan 31, 2022
Browse files
Fix spurious warning in TF TokenClassification models (#15435)
parent
554d333e
Changes
1
Show 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 @
7e56ba28
...
@@ -219,7 +219,7 @@ class TFTokenClassificationLoss:
...
@@ -219,7 +219,7 @@ class TFTokenClassificationLoss:
# make sure only labels that are not equal to -100
# make sure only labels that are not equal to -100
# are taken into account as loss
# are taken into account as loss
if
tf
.
math
.
reduce_any
(
labels
==
-
1
):
if
tf
.
math
.
reduce_any
(
labels
==
-
1
):
warnings
.
warn
(
"Using `-1` to mask the loss for the token is deprecated. Please use `-100` instead."
)
tf
.
print
(
"Using `-1` to mask the loss for the token is deprecated. Please use `-100` instead."
)
active_loss
=
tf
.
reshape
(
labels
,
(
-
1
,))
!=
-
1
active_loss
=
tf
.
reshape
(
labels
,
(
-
1
,))
!=
-
1
else
:
else
:
active_loss
=
tf
.
reshape
(
labels
,
(
-
1
,))
!=
-
100
active_loss
=
tf
.
reshape
(
labels
,
(
-
1
,))
!=
-
100
...
...
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