base_model
BaseModule
Bases: LightningModule, Module
Source code in meds_torch/models/base_model.py
__init__(cfg)
Initializes the BaseModule with the given configuration, setting up various components such as the optimizer, scheduler, model, and input encoder.
Parameters: cfg (DictConfig): The configuration dictionary specifying the setup of the module, including required elements like the task name and optional elements for configuring the optimizer, scheduler, model, and input encoder.
Raises: ValueError: If the task name is not specified in the configuration.
Returns: None
Source code in meds_torch/models/base_model.py
setup(stage)
Lightning hook that is called at the beginning of fit (train + validate), validate, test, or predict.
This is a good hook when you need to build models dynamically or adjust something about them. This hook is called on every process when using DDP.
:param stage: Either "fit", "validate", "test", or "predict".