From 2fb9bd795da1670e7ed7f3134652cf31aac10a96 Mon Sep 17 00:00:00 2001 From: Matthias Hertel Date: Fri, 3 Jul 2020 10:24:02 +0200 Subject: [PATCH] Fixed vocabulary in the entity linker training example (#5676) * entity linker training example: model loading changed according to issue 5668 (https://github.com/explosion/spaCy/issues/5668) + vocab_path is a required argument * contributor agreement --- examples/training/train_entity_linker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/training/train_entity_linker.py b/examples/training/train_entity_linker.py index 3a8deb7a0..a68007504 100644 --- a/examples/training/train_entity_linker.py +++ b/examples/training/train_entity_linker.py @@ -60,12 +60,12 @@ TRAIN_DATA = sample_train_data() output_dir=("Optional output directory", "option", "o", Path), n_iter=("Number of training iterations", "option", "n", int), ) -def main(kb_path, vocab_path=None, output_dir=None, n_iter=50): +def main(kb_path, vocab_path, output_dir=None, n_iter=50): """Create a blank model with the specified vocab, set up the pipeline and train the entity linker. The `vocab` should be the one used during creation of the KB.""" - vocab = Vocab().from_disk(vocab_path) # create blank English model with correct vocab - nlp = spacy.blank("en", vocab=vocab) + nlp = spacy.blank("en") + nlp.vocab.from_disk(vocab_path) nlp.vocab.vectors.name = "spacy_pretrained_vectors" print("Created blank 'en' model with vocab from '%s'" % vocab_path)