Experiment
Module containing the functions which create experiment components from Hydra configs.
This is essentially just calling hydra.utils.instantiate on the datamodule, network, trainer, and algorithm configs in a certain order.
This also adds the instance_attr custom resolver, which allows you to retrieve an attribute of an instantiated object instead of a config.
instantiate_datamodule #
instantiate_datamodule(
datamodule_config: (
Builds[type[LightningDataModule]]
| LightningDataModule
| None
),
) -> LightningDataModule | None
Instantiate the datamodule from the configuration dict.
Any interpolations in the config will have already been resolved by the time we get here.
instantiate_algorithm #
instantiate_algorithm(
algorithm_config: Config, datamodule: DataModule | 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 and network will be passed to the algorithm's constructor.