Avoid forcing a name on empty vectors, and remove print statement

This commit is contained in:
Matthew Honnibal 2018-03-28 21:08:58 +02:00
parent cf5fcf0546
commit a7c5ae2beb

View File

@ -695,6 +695,8 @@ def _fix_pretrained_vectors_name(nlp):
# data # data
if 'vectors' in nlp.meta and nlp.meta['vectors'].get('name'): if 'vectors' in nlp.meta and nlp.meta['vectors'].get('name'):
nlp.vocab.vectors.name = nlp.meta['vectors']['name'] nlp.vocab.vectors.name = nlp.meta['vectors']['name']
elif not nlp.vocab.vectors.size:
nlp.vocab.vectors.name = None
elif 'name' in nlp.meta and 'lang' in nlp.meta: elif 'name' in nlp.meta and 'lang' in nlp.meta:
vectors_name = '%s_%s.vectors' % (nlp.meta['lang'], nlp.meta['name']) vectors_name = '%s_%s.vectors' % (nlp.meta['lang'], nlp.meta['name'])
nlp.vocab.vectors.name = vectors_name nlp.vocab.vectors.name = vectors_name
@ -706,7 +708,6 @@ def _fix_pretrained_vectors_name(nlp):
if proc.cfg.get('pretrained_dims'): if proc.cfg.get('pretrained_dims'):
assert nlp.vocab.vectors.name assert nlp.vocab.vectors.name
proc.cfg['pretrained_vectors'] = nlp.vocab.vectors.name proc.cfg['pretrained_vectors'] = nlp.vocab.vectors.name
print(proc.cfg)
class DisabledPipes(list): class DisabledPipes(list):