mirror of https://github.com/explosion/spaCy.git
throw warning when model_cfg is None
This commit is contained in:
parent
102c8c7e2f
commit
e0fda2bd81
|
@ -104,6 +104,8 @@ 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
|
||||||
|
W097 = ("No Model config was provided to create the '{name}' component, "
|
||||||
|
"and no default configuration could be found either.")
|
||||||
W098 = ("No Model config was provided to create the '{name}' component, "
|
W098 = ("No Model config was provided to create the '{name}' component, "
|
||||||
"so a default configuration was used.")
|
"so a default configuration was used.")
|
||||||
W099 = ("Expected 'dict' type for the 'model' argument of pipe '{pipe}', "
|
W099 = ("Expected 'dict' type for the 'model' argument of pipe '{pipe}', "
|
||||||
|
|
|
@ -184,6 +184,7 @@ class Language(object):
|
||||||
self.max_length = max_length
|
self.max_length = max_length
|
||||||
self._optimizer = None
|
self._optimizer = None
|
||||||
|
|
||||||
|
# TODO: de-uglify (incorporating into component decorator didn't work because of circular imports)
|
||||||
from .ml.models.defaults import (
|
from .ml.models.defaults import (
|
||||||
default_tagger_config,
|
default_tagger_config,
|
||||||
default_parser_config,
|
default_parser_config,
|
||||||
|
@ -349,6 +350,8 @@ class Language(object):
|
||||||
if model_cfg is None and default_config is not None:
|
if model_cfg is None and default_config is not None:
|
||||||
warnings.warn(Warnings.W098.format(name=name))
|
warnings.warn(Warnings.W098.format(name=name))
|
||||||
model_cfg = default_config["model"]
|
model_cfg = default_config["model"]
|
||||||
|
if model_cfg is None:
|
||||||
|
warnings.warn(Warnings.W097.format(name=name))
|
||||||
model = None
|
model = None
|
||||||
if model_cfg is not None:
|
if model_cfg is not None:
|
||||||
self.config[name] = {"model": model_cfg}
|
self.config[name] = {"model": model_cfg}
|
||||||
|
|
Loading…
Reference in New Issue