Warn and fallback if vectors have no name

This commit is contained in:
Matthew Honnibal 2018-03-28 18:24:53 +02:00
parent fd9e259414
commit f8dd905a24

View File

@ -243,8 +243,9 @@ class PrecomputableAffine(Model):
def link_vectors_to_models(vocab):
vectors = vocab.vectors
if vectors.name is None:
raise ValueError(
"Unnamed vectors -- this won't allow multiple vectors "
vectors.name = VECTORS_KEY
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: