Update spacy/pipeline/tagger.pyx

Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
This commit is contained in:
Vinit Ravishankar 2023-02-17 18:41:03 +05:30 committed by GitHub
parent 028e1cbc8c
commit 240dbdabc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -258,8 +258,8 @@ class Tagger(TrainablePipe):
DOCS: https://spacy.io/api/tagger#get_loss
"""
validate_examples(examples, "Tagger.get_loss")
self.cfg["label_smoothing"] = 0.05 if self.cfg["label_smoothing"] else 0.0
loss_func = SequenceCategoricalCrossentropy(names=self.labels, normalize=False, neg_prefix=self.cfg["neg_prefix"], label_smoothing=self.cfg["label_smoothing"])
label_smoothing = 0.05 if self.cfg["label_smoothing"] else 0.0
loss_func = SequenceCategoricalCrossentropy(names=self.labels, normalize=False, neg_prefix=self.cfg["neg_prefix"], label_smoothing=label_smoothing)
# Convert empty tag "" to missing value None so that both misaligned
# tokens and tokens with missing annotation have the default missing
# value None.