caikit.core.model_management.model_initializer_base
A ModelInitializer is responsible for taking an in-memory ModuleConfig and producing a usable Module instance.
Configuration for ModelInitializers lives under the config as follows:
- model_management:
- initializers:
- <initializer name>:
type: <initializer type name> config:
<config option>: <value>
Classes
A class can be constructed by a factory if its constructor takes exactly |
Module Contents
- class caikit.core.model_management.model_initializer_base.ModelInitializerBase(config: aconfig.Config, instance_name: str)[source]
Bases:
caikit.core.toolkit.factory.FactoryConstructibleA class can be constructed by a factory if its constructor takes exactly one argument that is an aconfig.Config object and it has a name to identify itself with the factory.
- __doc__ = Multiline-String
Show Value
""" A ModelInitializer is responsible for taking an in-memory ModuleConfig and producing a usable Module instance. Configuration for ModelInitializers lives under the config as follows: model_management: initializers: <initializer name>: type: <initializer type name> config: <config option>: <value> """
- abstract init(model_config: caikit.core.modules.ModuleConfig, **kwargs) caikit.core.modules.ModuleBase | None[source]
Given a ModelConfig, attempt to initialize it for running
- Args:
- model_config (ModuleConfig): The in-memory model config object for
the model to be loaded
- **kwargs: All loaders must allow additional kwargs through so that
specific finders and loaders can support additional optional arguments.
- Returns:
- model (Optional[ModuleBase]): The in-memory ModuleBase instance that
is ready to run if successful. If unable to load, an exception may be raised, or None may be returned.