mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Save vectors init
This commit is contained in:
parent
6692833887
commit
1e38bea6e9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user