Skip to content

Commit 2fb9bd7

Browse files
author
Matthias Hertel
authored
Fixed vocabulary in the entity linker training example (#5676)
* entity linker training example: model loading changed according to issue 5668 (#5668) + vocab_path is a required argument * contributor agreement
1 parent a77c4c3 commit 2fb9bd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/training/train_entity_linker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ def sample_train_data():
6060
output_dir=("Optional output directory", "option", "o", Path),
6161
n_iter=("Number of training iterations", "option", "n", int),
6262
)
63-
def main(kb_path, vocab_path=None, output_dir=None, n_iter=50):
63+
def main(kb_path, vocab_path, output_dir=None, n_iter=50):
6464
"""Create a blank model with the specified vocab, set up the pipeline and train the entity linker.
6565
The `vocab` should be the one used during creation of the KB."""
66-
vocab = Vocab().from_disk(vocab_path)
6766
# create blank English model with correct vocab
68-
nlp = spacy.blank("en", vocab=vocab)
67+
nlp = spacy.blank("en")
68+
nlp.vocab.from_disk(vocab_path)
6969
nlp.vocab.vectors.name = "spacy_pretrained_vectors"
7070
print("Created blank 'en' model with vocab from '%s'" % vocab_path)
7171

0 commit comments

Comments
 (0)