mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 02:36:32 +03:00
Add warning
This commit is contained in:
parent
2bdf787417
commit
dc186afdc5
|
@ -104,6 +104,12 @@ class Warnings(object):
|
||||||
"string \"Field1=Value1,Value2|Field2=Value3\".")
|
"string \"Field1=Value1,Value2|Field2=Value3\".")
|
||||||
|
|
||||||
# TODO: fix numbering after merging develop into master
|
# TODO: fix numbering after merging develop into master
|
||||||
|
W095 = ("Model '{model}' ({model_version}) requires spaCy {version} and is "
|
||||||
|
"incompatible with the current version ({current}). This may lead "
|
||||||
|
"to unexpected results or runtime errors. To resolve this, "
|
||||||
|
"download a newer compatible model or retrain your custom model "
|
||||||
|
"with the current spaCy version. For more details and available "
|
||||||
|
"updates, run: python -m spacy validate")
|
||||||
W096 = ("The method 'disable_pipes' has become deprecated - use 'select_pipes' "
|
W096 = ("The method 'disable_pipes' has become deprecated - use 'select_pipes' "
|
||||||
"instead.")
|
"instead.")
|
||||||
W097 = ("No Model config was provided to create the '{name}' component, "
|
W097 = ("No Model config was provided to create the '{name}' component, "
|
||||||
|
|
|
@ -330,6 +330,16 @@ def get_model_meta(path):
|
||||||
for setting in ["lang", "name", "version"]:
|
for setting in ["lang", "name", "version"]:
|
||||||
if setting not in meta or not meta[setting]:
|
if setting not in meta or not meta[setting]:
|
||||||
raise ValueError(Errors.E054.format(setting=setting))
|
raise ValueError(Errors.E054.format(setting=setting))
|
||||||
|
if "spacy_version" in meta:
|
||||||
|
if not is_compatible_version(about.__version__, meta["spacy_version"]):
|
||||||
|
warnings.warn(
|
||||||
|
Warnings.W095.format(
|
||||||
|
model=f"{meta['lang']}_{meta['name']}",
|
||||||
|
model_version=meta["version"],
|
||||||
|
version=meta["spacy_version"],
|
||||||
|
current=about.__version__,
|
||||||
|
)
|
||||||
|
)
|
||||||
return meta
|
return meta
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user