lisbet.modeling.factory#
Model factory utilities for LISBET.
This module provides functions to create models from configuration Pydantic models, including support for built-in transformer presets and parameter overrides.
All configuration objects must be Pydantic models with fields matching the expected model constructor arguments.
Example
from lisbet.config.presets import instantiate_backbone_preset from lisbet.modeling.factory import create_model_from_config
cfg = instantiate_backbone_preset(“transformer-base”, feature_dim=32, embedding_dim=32) model = create_model_from_config(cfg)
Functions
|
Create a LISBET model from a configuration Pydantic model and head definitions. |
- lisbet.modeling.factory.create_model_from_config(model_config)[source]#
Create a LISBET model from a configuration Pydantic model and head definitions.
- Parameters:
model_config (
ModelConfig) – Configuration Pydantic model instance- Returns:
Instantiated LISBET model.
- Return type:
- Raises:
ValueError – If the backbone type is unknown or a task_id is unrecognized.
Notes
The config must be a Pydantic model with fields matching the backbone constructor.
The backbone config must have a ‘type’ field for discrimination.