caikit.core.model_management.local_model_initializer

The LocalModelInitializer loads a model locally, optionally with a non-local backend if the given module provides multiple backend-specific implementations.

Configuration for LocalModelInitializer lives under the config as follows:

model_management:
initializers:
<initializer name>:

type: LOCAL config:

# List of module backend configurations in priority order backend_priority:

  • type: LOCAL config: {}

Attributes

log

error

Classes

LocalModelInitializer

A class can be constructed by a factory if its constructor takes exactly

Module Contents

caikit.core.model_management.local_model_initializer.log[source]
caikit.core.model_management.local_model_initializer.error
class caikit.core.model_management.local_model_initializer.LocalModelInitializer(config: aconfig.Config, instance_name: str)[source]

Bases: caikit.core.model_management.model_initializer_base.ModelInitializerBase

A 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
"""
The LocalModelInitializer loads a model locally, optionally with a non-local backend
if the given module provides multiple backend-specific implementations.

Configuration for LocalModelInitializer lives under the config as follows:

model_management:
    initializers:
        <initializer name>:
            type: LOCAL
            config:
                # List of module backend configurations in priority order
                backend_priority:
                    - type: LOCAL
                      config: {}
"""
name = 'LOCAL'

This is the name of this constructible type that will be used by the factory to identify this class

_instance_name
_backends = []
init(model_config: caikit.core.modules.ModuleConfig, **kwargs) caikit.core.modules.ModuleBase | None[source]

Given a ModelConfig, attempt to initialize it locally, possibly using a non-local backend

Args:
model_config (ModuleConfig): The in-memory model config object for

the model to be initialized

Returns:
model (Optional[ModuleBase]): The in-memory ModuleBase instance that

is ready to run

property backends: List[caikit.core.module_backends.BackendBase]

Return an immutable view of the priority sequence of backends

static _supports_arg(load_fn: Callable, arg_name: str) bool[source]

A load function supports the load_backend kwarg IFF it has an arg explicitly named load_backend or it has a ** kwarg capture

_get_supported_load_backends(backend_impl: caikit.core.modules.ModuleBase)[source]

Function to get a list of supported load backends that the module supports

Args:
backend_impl: caikit.core.ModuleBase

Module implementing the backend

Returns:
list(backend_types)

list of backends that are supported for model load

static _configure_backend_overrides(backend: str, backend_instance: object)[source]

Function to go over all the modules registered in the MODULE_BACKEND_REGISTRY for a particular backend and configure their backend overrides

Args:
backend: str

Name of the backend to select from registry

backend_instance: object

Initialized backend instance. This object should implement the register_config function which will be used to merge / iteratively configure the backend