mirror of https://github.com/explosion/spaCy.git
Integrate initialize settings
This commit is contained in:
parent
dec984a9c1
commit
78396d137f
|
@ -1217,9 +1217,10 @@ class Language:
|
|||
name="tokenizer",
|
||||
)
|
||||
self.tokenizer.initialize(get_examples, nlp=self, **tok_settings)
|
||||
proc_settings = settings.get("components", {})
|
||||
for name, proc in self.pipeline:
|
||||
if hasattr(proc, "initialize"):
|
||||
p_settings = settings.get(name, {})
|
||||
p_settings = proc_settings.get(name, {})
|
||||
p_settings = validate_init_settings(
|
||||
proc.initialize, p_settings, section="components", name=name
|
||||
)
|
||||
|
|
|
@ -55,9 +55,7 @@ def init_nlp(config: Config, *, use_gpu: int = -1, silent: bool = True) -> Langu
|
|||
msg.info(f"Resuming training for: {resume_components}")
|
||||
nlp.resume_training(sgd=optimizer)
|
||||
with nlp.select_pipes(disable=[*frozen_components, *resume_components]):
|
||||
nlp.initialize(
|
||||
lambda: train_corpus(nlp), sgd=optimizer, settings=I["components"]
|
||||
)
|
||||
nlp.initialize(lambda: train_corpus(nlp), sgd=optimizer, settings=I)
|
||||
msg.good("Initialized pipeline components")
|
||||
# Verify the config after calling 'initialize' to ensure labels
|
||||
# are properly initialized
|
||||
|
|
Loading…
Reference in New Issue