Load a model from an installed package. name (str): The package name. vocab (Vocab / True): Optional vocab to pass in on initialization. If True, a new Vocab object will be created. disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled
(
name: str,
*,
vocab: Union["Vocab", bool] = True,
disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
config: Union[Dict[str, Any], Config] = SimpleFrozenDict(),
)
| 532 | |
| 533 | |
| 534 | def load_model_from_package( |
| 535 | name: str, |
| 536 | *, |
| 537 | vocab: Union["Vocab", bool] = True, |
| 538 | disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, |
| 539 | enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, |
| 540 | exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES, |
| 541 | config: Union[Dict[str, Any], Config] = SimpleFrozenDict(), |
| 542 | ) -> "Language": |
| 543 | """Load a model from an installed package. |
| 544 | |
| 545 | name (str): The package name. |
| 546 | vocab (Vocab / True): Optional vocab to pass in on initialization. If True, |
| 547 | a new Vocab object will be created. |
| 548 | disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable. Disabled |
| 549 | pipes will be loaded but they won't be run unless you explicitly |
| 550 | enable them by calling nlp.enable_pipe. |
| 551 | enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other |
| 552 | pipes will be disabled (and can be enabled using `nlp.enable_pipe`). |
| 553 | exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude. Excluded |
| 554 | components won't be loaded. |
| 555 | config (Dict[str, Any] / Config): Config overrides as nested dict or dict |
| 556 | keyed by section values in dot notation. |
| 557 | RETURNS (Language): The loaded nlp object. |
| 558 | """ |
| 559 | cls = importlib.import_module(name) |
| 560 | return cls.load( |
| 561 | vocab=vocab, disable=disable, enable=enable, exclude=exclude, config=config |
| 562 | ) # type: ignore[attr-defined] |
| 563 | |
| 564 | |
| 565 | def load_model_from_path( |
no test coverage detected
searching dependent graphs…