diff --git a/spacy/cli/init_model.py b/spacy/cli/init_model.py index 3de17e70f..4aaf7cd5e 100644 --- a/spacy/cli/init_model.py +++ b/spacy/cli/init_model.py @@ -69,7 +69,8 @@ def init_model(lang, output_dir, freqs_loc=None, clusters_loc=None, jsonl_loc=No vectors_loc = ensure_path(vectors_loc) if vectors_loc and vectors_loc.parts[-1].endswith('.npz'): vectors_data = numpy.load(vectors_loc.open('rb')) - vector_keys = [lex['orth'] for lex in lex_attrs if 'id' in lex] + vector_keys = [lex['orth'] for lex in lex_attrs + if 'rank' in lex and lex['rank'] < vectors_data.shape[0]] else: vectors_data, vector_keys = read_vectors(vectors_loc) if vectors_loc else (None, None) nlp = create_model(lang, lex_attrs, vectors_data, vector_keys, prune_vectors)