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
if vectors.name is None:
vectors.name = VECTORS_KEY
print(
"Warning: Unnamed vectors -- this won't allow multiple vectors "
"models to be loaded. (Shape: (%d, %d))" % vectors.data.shape)
if vectors.data.size != 0:
print(
"Warning: Unnamed vectors -- this won't allow multiple vectors "
"models to be loaded. (Shape: (%d, %d))" % vectors.data.shape)
ops = Model.ops
for word in vocab:
if word.orth in vectors.key2row: