Configure Your Lightning Trainer
Under the framework of PyTorch Lightning, we use the Lightning Trainer object for all stuff related to training, such as number of epochs, training strategy, device, etc. Just like optimizer, each task is supposed to be given a trainer for training. We could either use a uniform trainer across all tasks or assign a distinct trainer to each task.
To configure the Lightning trainer for your experiment, link the trainer
field in the main YAML file to sub-config file in the sub-directory lightning.Trainer
and its arguments in the sub-config. Note that there is only one type of Trainer class i.e. lightning.Trainer
that we specify. Here is an example:
./clarena/example_configs
├── __init__.py
├── entrance.yaml
├── experiment
│ ├── example.yaml
│ └── ...
├── trainer
│ └── cpu.yaml
...
example_configs/experiment/example.yaml
defaults:
...
- /trainer: cpu.yaml
...
example_configs/trainer/cpu.yaml
_target_: lightning.Trainer
default_root_dir: ./outputs/${experiment_name}/${now:%Y-%m-%d_%H-%M-%S}
log_every_n_steps: 500
accelerator: cpu
devices: 1
max_epochs: 9
Supported Training Options
Please refer to Lightning documentation for all supported config fields (arguments) for the trainer.