From e50047f1c5e9949894bbba0a3183295fc79f2f2b Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 5 Oct 2020 20:02:45 +0200 Subject: [PATCH] Check lengths match --- spacy/ml/models/tok2vec.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spacy/ml/models/tok2vec.py b/spacy/ml/models/tok2vec.py index 3a7da4a8e..65d2bffbb 100644 --- a/spacy/ml/models/tok2vec.py +++ b/spacy/ml/models/tok2vec.py @@ -136,6 +136,8 @@ def MultiHashEmbed( include_static_vectors (bool): Whether to also use static word vectors. Requires a vectors table to be loaded in the Doc objects' vocab. """ + if len(rows) != len(attrs): + raise ValueError(f"Mismatched lengths: {len(rows)} vs {len(attrs)}") seed = 7 def make_hash_embed(index):