diff --git a/spacy/pipeline/tagger.pyx b/spacy/pipeline/tagger.pyx index ae59d0983..243657517 100644 --- a/spacy/pipeline/tagger.pyx +++ b/spacy/pipeline/tagger.pyx @@ -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.