mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
Add warning if initial vectors are empty (#7641)
See #7637, where this came up.
This commit is contained in:
parent
f6ad4684bd
commit
7944761ba7
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue
Block a user