kaira.models.generic.SequentialModel

Inheritance diagram of SequentialModel

Inheritance diagram for SequentialModel

class kaira.models.generic.SequentialModel(steps: Sequence[Callable] | None = None, *args: Any, **kwargs: Any)[source]

Bases: ConfigurableModel

A model that processes steps sequentially.

Each step receives the output of the previous step as its input.

Methods

__init__

Initialize the sequential model.

add_step

Add a processing step to the model.

forward

Execute the model sequentially on the input data.

from_config

Create model instance from configuration.

from_hydra_config

Create model from Hydra DictConfig.

from_pretrained_config

Create model from Hugging Face PretrainedConfig.

remove_step

Remove a processing step from the model.

Examples using kaira.models.generic.SequentialModel

Original DeepJSCC Model (Bourtsoulatze 2019) with Training

Original DeepJSCC Model (Bourtsoulatze 2019) with Training

Deep Joint Source-Channel Coding (DeepJSCC) Model - Bourtsoulatze2019 Implementation

Deep Joint Source-Channel Coding (DeepJSCC) Model - Bourtsoulatze2019 Implementation
__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

classmethod from_config(config, **kwargs)

Create model instance from configuration.

Parameters:
  • config – Configuration object (PretrainedConfig, DictConfig, or dict)

  • **kwargs – Additional parameters to override config

Returns:

Model instance

classmethod from_hydra_config(config: DictConfig, **kwargs)

Create model from Hydra DictConfig.

Parameters:
  • config – Hydra configuration

  • **kwargs – Additional parameters

Returns:

Model instance

classmethod from_pretrained_config(config: PretrainedConfig, **kwargs)

Create model from Hugging Face PretrainedConfig.

Parameters:
  • config – PretrainedConfig instance

  • **kwargs – Additional parameters

Returns:

Model instance

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