From 9fcbc8eb67e0f088bd40dcdddd2c0fd187916a76 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Mon, 26 Jun 2023 11:46:09 +0200 Subject: [PATCH] add pipe_instances also to load_model_from_init_py --- spacy/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spacy/util.py b/spacy/util.py index 35278c848..24be79fa6 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -675,6 +675,7 @@ def load_model_from_init_py( enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), + pipe_instances: Dict[str, Any] = SimpleFrozenDict(), ) -> "Language": """Helper function to use in the `load()` method of a model package's __init__.py. @@ -690,6 +691,9 @@ def load_model_from_init_py( components won't be loaded. config (Dict[str, Any] / Config): Config overrides as nested dict or dict keyed by section values in dot notation. + pipe_instances (Dict[str, Any]): Dictionary of components + to be added to the pipeline directly (not created from + config) RETURNS (Language): The loaded nlp object. """ model_path = Path(init_file).parent