mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-13 02:36:32 +03:00
Integrate initialize settings
This commit is contained in:
parent
dec984a9c1
commit
78396d137f
|
@ -1217,9 +1217,10 @@ class Language:
|
||||||
name="tokenizer",
|
name="tokenizer",
|
||||||
)
|
)
|
||||||
self.tokenizer.initialize(get_examples, nlp=self, **tok_settings)
|
self.tokenizer.initialize(get_examples, nlp=self, **tok_settings)
|
||||||
|
proc_settings = settings.get("components", {})
|
||||||
for name, proc in self.pipeline:
|
for name, proc in self.pipeline:
|
||||||
if hasattr(proc, "initialize"):
|
if hasattr(proc, "initialize"):
|
||||||
p_settings = settings.get(name, {})
|
p_settings = proc_settings.get(name, {})
|
||||||
p_settings = validate_init_settings(
|
p_settings = validate_init_settings(
|
||||||
proc.initialize, p_settings, section="components", name=name
|
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}")
|
msg.info(f"Resuming training for: {resume_components}")
|
||||||
nlp.resume_training(sgd=optimizer)
|
nlp.resume_training(sgd=optimizer)
|
||||||
with nlp.select_pipes(disable=[*frozen_components, *resume_components]):
|
with nlp.select_pipes(disable=[*frozen_components, *resume_components]):
|
||||||
nlp.initialize(
|
nlp.initialize(lambda: train_corpus(nlp), sgd=optimizer, settings=I)
|
||||||
lambda: train_corpus(nlp), sgd=optimizer, settings=I["components"]
|
|
||||||
)
|
|
||||||
msg.good("Initialized pipeline components")
|
msg.good("Initialized pipeline components")
|
||||||
# Verify the config after calling 'initialize' to ensure labels
|
# Verify the config after calling 'initialize' to ensure labels
|
||||||
# are properly initialized
|
# are properly initialized
|
||||||
|
|
Loading…
Reference in New Issue
Block a user