kaira.models.ConfigurableModel

Inheritance diagram for ConfigurableModel
- class kaira.models.ConfigurableModel(config=None, *args: Any, **kwargs: Any)[source]
Bases:
BaseModelModel 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
Initialize the configurable model.
Add a processing step to the model.
Process input through all steps sequentially.
Create model instance from configuration.
Create model from Hydra DictConfig.
Create model from Hugging Face PretrainedConfig.
Remove a processing step from the model.
Examples using
kaira.models.ConfigurableModel
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- 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
- 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