Unverified Commit 7e56ba28 authored by Matt's avatar Matt Committed by GitHub
Browse files

Fix spurious warning in TF TokenClassification models (#15435)

parent 554d333e
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment