vipr.plugins.inference.handlers package¶
Submodules¶
vipr.plugins.inference.handlers.data_loader module¶
- class vipr.plugins.inference.handlers.data_loader.DataLoaderHandler(**kw: Any)¶
Bases:
DataLoaderInterface,HandlerBase handler for data loaders. Specific implementations should override _load_data method.
- load_data(**kwargs) DataSet¶
Loads data from a specified path.
If the handler class has a
__vipr_params_model__(set by@discover_data_loader), unknown keys are stripped from kwargs before forwarding to_load_data. This preventsextra='forbid'validation errors when the config contains keys intended for other handlers.- Parameters:
data_path – Optional path to data file
**kwargs – Additional parameters for data loading
- Returns:
DataSet containing loaded data with x, y, errors, and metadata
vipr.plugins.inference.handlers.model_builder module¶
- class vipr.plugins.inference.handlers.model_builder.ModelBuilderHandler(**kw: Any)¶
Bases:
ModelBuilderInterface,HandlerBase handler for building executable models from model packages.
vipr.plugins.inference.handlers.model_loader module¶
- class vipr.plugins.inference.handlers.model_loader.ModelLoaderHandler(**kw: Any)¶
Bases:
ModelLoaderInterface,Handler- load_model(**kwargs)¶
Loads a model of the given type.
If the handler class has a
__vipr_params_model__(set by@discover_model_loader), unknown keys are stripped from kwargs before forwarding to_load_model. This preventsextra='forbid'validation errors when the config contains keys intended for other handlers.- Parameters:
**kwargs – Additional parameters for model initialization
- Returns:
The loaded model
vipr.plugins.inference.handlers.postprocessor module¶
Base class for postprocessor handlers in the VIPR framework.
- exception vipr.plugins.inference.handlers.postprocessor.PostprocessorError¶
Bases:
VIPRErrorException raised for postprocessor related errors.
- class vipr.plugins.inference.handlers.postprocessor.PostprocessorHandler(**kw: Any)¶
Bases:
PostprocessorInterface,HandlerBase postprocessor handler for processing results after predictions.
- abstract postprocess(data: Any, **kwargs) Any¶
Postprocess the prediction results.
- Parameters:
data – Input data to postprocess (typically prediction results)
**kwargs – Parameters controlling postprocessing behavior
- Returns:
Postprocessed results
- Return type:
Any
- Raises:
PostprocessorError – If postprocessing fails
vipr.plugins.inference.handlers.predictor module¶
- class vipr.plugins.inference.handlers.predictor.PredictorHandler(**kw: Any)¶
Bases:
PredictorInterface,HandlerBase handler for predictor implementations with unified DataSet interface.
- predict(dataset, model: Any, params: dict[str, Any] | None = None) dict[str, Any]¶
Make predictions using the model with unified DataSet interface.
If the handler class has a
__vipr_params_model__(set by@discover_predictor), unknown keys are stripped from params before forwarding to_predict. This preventsextra='forbid'validation errors when the YAML config contains keys intended for other handlers.- Parameters:
dataset – DataSet with batch-first format (batch_size, n_points)
model – Model to use for prediction
params – Additional parameters for prediction control
- Returns:
Dict with prediction results in batch format
Module contents¶
Inference-specific handler base classes.
- class vipr.plugins.inference.handlers.DataLoaderHandler(**kw: Any)¶
Bases:
DataLoaderInterface,HandlerBase handler for data loaders. Specific implementations should override _load_data method.
- load_data(**kwargs) DataSet¶
Loads data from a specified path.
If the handler class has a
__vipr_params_model__(set by@discover_data_loader), unknown keys are stripped from kwargs before forwarding to_load_data. This preventsextra='forbid'validation errors when the config contains keys intended for other handlers.- Parameters:
data_path – Optional path to data file
**kwargs – Additional parameters for data loading
- Returns:
DataSet containing loaded data with x, y, errors, and metadata
- class vipr.plugins.inference.handlers.ModelBuilderHandler(**kw: Any)¶
Bases:
ModelBuilderInterface,HandlerBase handler for building executable models from model packages.
- class vipr.plugins.inference.handlers.ModelLoaderHandler(**kw: Any)¶
Bases:
ModelLoaderInterface,Handler- load_model(**kwargs)¶
Loads a model of the given type.
If the handler class has a
__vipr_params_model__(set by@discover_model_loader), unknown keys are stripped from kwargs before forwarding to_load_model. This preventsextra='forbid'validation errors when the config contains keys intended for other handlers.- Parameters:
**kwargs – Additional parameters for model initialization
- Returns:
The loaded model
- class vipr.plugins.inference.handlers.PostprocessorHandler(**kw: Any)¶
Bases:
PostprocessorInterface,HandlerBase postprocessor handler for processing results after predictions.
- abstract postprocess(data: Any, **kwargs) Any¶
Postprocess the prediction results.
- Parameters:
data – Input data to postprocess (typically prediction results)
**kwargs – Parameters controlling postprocessing behavior
- Returns:
Postprocessed results
- Return type:
Any
- Raises:
PostprocessorError – If postprocessing fails
- class vipr.plugins.inference.handlers.PredictorHandler(**kw: Any)¶
Bases:
PredictorInterface,HandlerBase handler for predictor implementations with unified DataSet interface.
- predict(dataset, model: Any, params: dict[str, Any] | None = None) dict[str, Any]¶
Make predictions using the model with unified DataSet interface.
If the handler class has a
__vipr_params_model__(set by@discover_predictor), unknown keys are stripped from params before forwarding to_predict. This preventsextra='forbid'validation errors when the YAML config contains keys intended for other handlers.- Parameters:
dataset – DataSet with batch-first format (batch_size, n_points)
model – Model to use for prediction
params – Additional parameters for prediction control
- Returns:
Dict with prediction results in batch format