Skip to content

Main

Training script using Hydra.

This does the following: 1. Parses the config using Hydra; 2. Instantiated the components (trainer / algorithm), optionally datamodule and network; 3. Trains the model; 4. Optionally runs an evaluation loop.

main #

main(dict_config: DictConfig) -> dict

Main entry point: trains & evaluates a learning algorithm.

instantiate_algorithm #

instantiate_algorithm(
    algorithm_config: HydraConfigFor[
        LightningModule | JaxModule
    ],
    datamodule: LightningDataModule | None = None,
) -> LightningModule | JaxModule

Function used to instantiate the algorithm.

It is suggested that your algorithm (LightningModule) take in the datamodule and network as arguments, to make it easier to swap out different networks and datamodules during experiments.

The instantiated datamodule will be passed to the algorithm's constructor.