Only try to load vectors if they exist.

This commit is contained in:
Matthew Honnibal 2016-11-23 13:50:24 +01:00
parent 618ac36093
commit 60eb2343ce

View File

@ -57,7 +57,8 @@ class BaseDefaults(object):
return False return False
else: else:
vec_path = nlp.path / 'vocab' / 'vec.bin' vec_path = nlp.path / 'vocab' / 'vec.bin'
return lambda vocab: vocab.load_vectors_from_bin_loc(vec_path) if vec_path.exists():
return lambda vocab: vocab.load_vectors_from_bin_loc(vec_path)
@classmethod @classmethod
def create_tokenizer(cls, nlp=None): def create_tokenizer(cls, nlp=None):