Class Signature
Basemodel class serves as the abstract base class for all time series foundation models in Samay. All model implementations inherit from this class and must implement its abstract methods.
Initialization Parameters
Model configuration dictionary containing model-specific parameters.
Hugging Face model repository ID for loading pre-trained models.
Attributes
Stores the model configuration passed during initialization.
The device (CPU or GPU) on which the model will run. Automatically selects the least used GPU if available, otherwise defaults to CPU.
Methods
finetune()
Dataset used for finetuning.
Optional keyword arguments for finetuning:
lr(float): Learning rateepoch(int): Number of training epochs- Additional model-specific parameters
Model or training result produced by the finetune operation. The exact return type is defined by concrete model implementations.
NotImplementedError: If a subclass does not implement this method.
forecast()
Input data for forecasting (e.g., torch.Tensor, numpy array, or model-specific input structure).
Optional keyword arguments for forecasting (model-specific).
Forecast outputs. The concrete model defines the exact format (for example, mean forecasts, quantiles, or full distribution).
NotImplementedError: If a subclass does not implement this method.
evaluate()
Dataset used for evaluation.
Optional evaluation arguments:
metric_only(bool): If True, return only metrics dictionary- Additional model-specific parameters
Evaluation metrics or (metrics, details) tuple as defined by the concrete model implementation.
NotImplementedError: If a subclass does not implement this method.
save()
Filesystem path where model artifacts should be saved.
This method does not return a value.
NotImplementedError: If a subclass does not implement this method.
Usage Example
Notes
- The
Basemodelclass automatically detects and uses the least utilized GPU when available - All concrete model implementations must override the abstract methods:
finetune(),forecast(),evaluate(), andsave() - Device selection happens automatically during initialization based on GPU availability