kaira.models.ConfigurableModel

Inheritance diagram of ConfigurableModel

Inheritance diagram for ConfigurableModel

class kaira.models.ConfigurableModel(*args: Any, **kwargs: Any)[source]

Bases: BaseModel

Model that supports dynamically adding and removing steps.

This class extends the basic model functionality with methods to add, remove, and manage model steps during runtime.

Methods

__init__

Initialize the configurable model.

add_step

Add a processing step to the model.

forward

Process input through all steps sequentially.

remove_step

Remove a processing step from the model.

__init__(*args: Any, **kwargs: Any)[source]

Initialize the configurable model.

add_step(step: Callable) ConfigurableModel[source]

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[source]

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

forward(input_data: Any, *args: Any, **kwargs: Any) Any[source]

Process input through all steps sequentially.

Parameters:
  • input_data (Any) – The input to process

  • *args (Any) – Positional arguments passed to each step

  • **kwargs (Any) – Additional keyword arguments passed to each step

Returns:

The result after applying all steps