如果有一种方法可以在spaCy中重现训练结果,那就太好了。片段下方训练了一个普通的NER组件,但在单独的运行中显示了不同的结果。这是预期的行为吗?
import spacy
spacy.util.fix_random_seed()
nlp = spacy.blank("en")
ner = nlp.create_pipe("ner")
ner.add_label("TEST")
nlp.add_pipe(ner)
losses = {}
nlp.begin_training()
nlp.update(
["test"], # batch of texts
[{"entities": [(0, 4, "TEST")]}], # batch of annotations
losses=losses,
)
print(losses)