Fix init_model

This commit is contained in:
Matthew Honnibal 2018-07-03 22:57:11 +02:00
parent 019d09e3c3
commit 4a38a26cb5
1 changed files with 2 additions and 2 deletions

View File

@ -68,8 +68,8 @@ def init_model(lang, output_dir, freqs_loc=None, clusters_loc=None, jsonl_loc=No
lex_attrs = read_attrs_from_deprecated(freqs_loc, clusters_loc)
vectors_loc = ensure_path(vectors_loc)
if vectors_loc and vectors_loc.parts[-1].endswith('.npz'):
vector_data = numpy.load(vectors_loc.open('rb'))
vectors_keys = [lex['orth'] for lex in lex_attrs if 'id' in lex]
vectors_data = numpy.load(vectors_loc.open('rb'))
vector_keys = [lex['orth'] for lex in lex_attrs if 'id' in lex]
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)