pip install git+https://github.com/romesco/hydra-lightning/#subdirectory=hydra-configs-pytorch-lightning
from hydra_configs.pytorch_lightning.trainer import TrainerConf
This is a collection of auto-generated configuration files to enable using Pytorch Lightning with Hydra. The emphasis on this repository is to provide a stable set of base configs that track the current versions of Lightning and Hydra. If either changes its API, these configs will update automatically as well.
Here is an example of the base config for the EarlyStopping
Callback from Pytorch Lightning:
@dataclass
class EarlyStoppingConf:
_target_: str = "pytorch_lightning.callbacks.EarlyStopping"
monitor: str = "early_stop_on"
min_delta: float = 0.0
patience: int = 3
verbose: bool = False
mode: str = "auto"
strict: bool = True
This is useful because it allows you to quickly import these configs like:
from hydra_configs.pytorch_lightning.callbacks import EarlyStoppingConf
Now you are free to use this config with its pre-set defaults and override any values programatically using one of:
- command line args
- yaml files
- structured configs (dataclasses)
If you're interested in configuring Lightning classes, you're probably interested in configuring normal torch classes as well. Things like:
Adam
LRStep
Linear
Dataset
DataLoader
...
Please find those in the pytorch repository: https://github.com/pytorch/hydra-torch/
- Basic Tutorial
- Intermediate Tutorial (coming soon)
- Advanced Tutorial (coming soon)
- Basic Tutorial (coming soon - for now see examples/mnist_00.py).
- Intermediate Tutorial (coming soon)
poetry install
poetry run generate-configs