Only warn about unnamed vectors if non-zero sized.

This commit is contained in:
Matthew Honnibal 2018-05-19 18:51:55 +02:00
parent 260707a4c3
commit 401213fb1f

View File

@ -229,9 +229,10 @@ def link_vectors_to_models(vocab):
vectors = vocab.vectors vectors = vocab.vectors
if vectors.name is None: if vectors.name is None:
vectors.name = VECTORS_KEY vectors.name = VECTORS_KEY
print( if vectors.data.size != 0:
"Warning: Unnamed vectors -- this won't allow multiple vectors " print(
"models to be loaded. (Shape: (%d, %d))" % vectors.data.shape) "Warning: Unnamed vectors -- this won't allow multiple vectors "
"models to be loaded. (Shape: (%d, %d))" % vectors.data.shape)
ops = Model.ops ops = Model.ops
for word in vocab: for word in vocab:
if word.orth in vectors.key2row: if word.orth in vectors.key2row: