API Reference

train_foundation_model

monad.ui.train_foundation_model

monad.ui.train_foundation_model(output_path, use_last_basket_sketches=True, recency_sketch_timespan_days=RECENCY_SKETCH_TIMESPAN_DAYS_DEFAULT, storage_config_path=None, callbacks:=None, pl_logger:=None, resume=False, overwrite=False, seed=None)

Trains the foundation model using intermediate outputs from the fitting step.

from monad.ui import train_foundation_model
from pathlib import Path

train_foundation_model(output_path=Path("path/to/store/pretrain/artifacts"))


Parameters

output_path : str
Path to store training results.


storage_config_path : Optional[pathlib.Path]
Default: None
File system configuration.


resume : bool
Default: False
If True, training will be resumed from the last checkpoint if such exists, an error will be thrown otherwise.


overwrite: bool
Default: False
If True, any previous training results will be overwritten. Otherwise, if resume is not set and checkpoints from previous training are present, error will be raised.


callbacks: Optional[list[lightning.pytorch.callbacks.Callback]] Default: None
List of additional Pytorch Lightning callbacks to add to training.


pl_logger: Optional[pytorch_lightning.loggers.Logger]
Default: None
PyTorch Lightning-compatible logger to use.


use_last_basket_sketches: bool
Default: True
Whether to include a sketch of the most recent events as an additional input.


recency_sketch_timespan_days: Optional[int] Default: RECENCY_SKETCH_TIMESPAN_DAYS_DEFAULT
If set, defines the window in days for recency-based sketches. seed: int Optional. Default: None Seed for the training, when provided, ensures reproducibility of the results.


Returns

Saves results under output_path.