kaira.models.BaseModel

Inheritance diagram of BaseModel

Inheritance diagram for BaseModel

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

Bases: Module, ABC

Abstract base class for all models in the Kaira framework.

This class extends PyTorch’s nn.Module and adds framework-specific functionality. All models should inherit from this class to ensure compatibility with the framework’s training, evaluation, and inference pipelines.

The class provides a consistent interface for model implementation while allowing flexibility in architecture design. It enforces proper initialization and forward pass implementation.

Methods

__init__

Initialize the model.

forward

Define the forward pass computation.

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

Initialize the model.

Parameters:
  • *args – Variable positional arguments.

  • **kwargs – Variable keyword arguments.

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

Define the forward pass computation.

This method should be implemented by all subclasses to define how input data is processed through the model to produce output.

Parameters:
  • *args – Variable positional arguments for flexible input handling

  • **kwargs – Variable keyword arguments for optional parameters

Returns:

Model output, type depends on specific implementation

Return type:

Any

Raises:

NotImplementedError – If the subclass does not implement this method