diff --git a/spacy/errors.py b/spacy/errors.py index 289d2cfed..89b09c09a 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -157,6 +157,8 @@ class Warnings: "`spacy.load()` to ensure that the model is loaded on the correct " "device. More information: " "http://spacy.io/usage/v3#jupyter-notebook-gpu") + W112 = ("The model specified to use for initial vectors ({name}) has no " + "vectors. This is almost certainly a mistake.") @add_codes diff --git a/spacy/training/initialize.py b/spacy/training/initialize.py index f623627eb..69861a9a9 100644 --- a/spacy/training/initialize.py +++ b/spacy/training/initialize.py @@ -133,6 +133,10 @@ def load_vectors_into_model( ) err = ConfigValidationError.from_error(e, title=title, desc=desc) raise err from None + + if len(vectors_nlp.vocab.vectors.keys()) == 0: + logger.warning(Warnings.W112.format(name=name)) + nlp.vocab.vectors = vectors_nlp.vocab.vectors if add_strings: # I guess we should add the strings from the vectors_nlp model?