caikit.core.modules.decorator
This module holds the @module decorator which is used to decorate a caikit.module
Attributes
Functions
|
Apply this decorator to any class that should be treated as a caikit module |
|
This function will register the mapping for the given module_id and |
Module Contents
- caikit.core.modules.decorator.error
- caikit.core.modules.decorator.SUPPORTED_LOAD_BACKENDS_VAR_NAME = 'SUPPORTED_LOAD_BACKENDS'
- caikit.core.modules.decorator.module(id=None, name=None, version=None, task: Type[caikit.core.task.TaskBase] = None, tasks: List[Type[caikit.core.task.TaskBase]] | None = None, backend_type='LOCAL', base_module: str | Type[caikit.core.modules.base.ModuleBase] = None, backend_config_override: Dict | None = None)[source]
- Apply this decorator to any class that should be treated as a caikit module
(i.e., extends`{caikit.core.ModuleBase}) and registered with caikit.core so that the library “knows” the class is a caikit module and is capable of loading instances of the module.
- Args:
- id: str
A UUID to use when registering this module with caikit.core Not required if based on another caikit module using base_module
- name: str
A human-readable name for the module Not required if based on another caikit module using base_module
- version: str
A SemVer for the module Not required if based on another caikit module using base_module
- task: Type[TaskBase]
An ML task class that this module is an implementation for Not required if based on another caikit module using base_module, or if multiple tasks are specified using tasks.
- tasks: Optional[List[Type[TaskBase]]
List of ML task classes that this module implements.
- backend_type: backend_type
Associated backend type for the module. Default: LOCAL
- base_module: str | ModuleBase
If this module is based on a different caikit module, provide name of the base module. Default: None
- backend_config_override: Dict
Dictionary containing configuration required for the specific backend. Default: None
- Returns:
A decorated version of the class to which it was applied, after registering the class as a valid module with caikit.core
- caikit.core.modules.decorator._register_module_implementation(implementation_class: type, backend_type: str, module_id: str, backend_config_override: Dict = None)[source]
This function will register the mapping for the given module_id and backend_type to the implementation class
- Args:
- implementation_class (type): The class that is used to implement this
backend type for the given module_id
- backend_type (str): Value from MODULE_BACKEND_TYPES that indicates the
backend that this class implements
- module_id (str): The module_id from the caikit.core module registry that
this class overloads
- backend_config_override (Dict): Dictionary containing essential
overrides for the backend config. This will get stored with the implementation_class class name and will automatically get picked up and merged with other such configs for a specific backend