kaira.models.generic.SequentialModel

Inheritance diagram for SequentialModel
- class kaira.models.generic.SequentialModel(steps: Sequence[Callable] | None = None, *args: Any, **kwargs: Any)[source]
Bases:
ConfigurableModelA model that processes steps sequentially.
Each step receives the output of the previous step as its input.
Methods
Initialize the sequential model.
Add a processing step to the model.
Execute the model sequentially on the input data.
Remove a processing step from the model.
- __init__(steps: Sequence[Callable] | None = None, *args: Any, **kwargs: Any)[source]
Initialize the sequential model.
- Parameters:
steps – Optional initial list of processing steps
*args – Variable positional arguments passed to the base class.
**kwargs – Variable keyword arguments passed to the base class.
- forward(input_data: Any, *args: Any, **kwargs: Any) Any[source]
Execute the model sequentially on the input data.
- Parameters:
input_data – The initial data to process
*args – Additional positional arguments passed to each step.
**kwargs – Additional keyword arguments passed to each step.
- Returns:
The final result after passing through all steps
- add_step(step: Callable) ConfigurableModel
Add a processing step to the model.
- Parameters:
step – A callable that will be added to the processing pipeline. Must accept and return tensor-like objects.
- Returns:
Self for method chaining
- remove_step(index: int) ConfigurableModel
Remove a processing step from the model.
- Parameters:
index – The index of the step to remove
- Returns:
Self for method chaining
- Raises:
IndexError – If the index is out of range