lightning-hydra-template: A PyTorch Lightning and Hydra Project Template
PyTorch Lightning + Hydra. A very user-friendly template for ML experimentation. ⚡🔥⚡
At a glance
- What is it?
- lightning-hydra-template is an unofficial community project that combines PyTorch Lightning with Hydra's configuration system to reduce boilerplate in deep learning experiments. The README is explicit about four scenarios where this template is the wrong choice, which is a useful starting point for evaluating it.
- Who is it for?
- lightning-hydra-template is the right starting point for deep learning researchers who work with ready-to-use datasets and want to run controlled experiments with hyperparameter overrides from the command line. It is the wrong choice for teams building data pipelines that depend on each other, for projects that need to resume interrupted Hydra multiruns, or for any use case where the configuration setup would need significant restructuring beyond simple Lightning training.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 114 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 3, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Reducing Boilerplate in Deep Learning Research
lightning-hydra-template addresses the overhead that accumulates when starting a new deep learning project. Setting up training loops, handling accelerator configuration, wiring experiment loggers, and managing hyperparameter files are all tasks that repeat across projects but contribute nothing specific to the research question. The template packages those patterns once so new projects can start from a consistent baseline.
The README identifies three reasons to use it: it saves boilerplate (models, datasets, tasks, experiments, and accelerator configurations are pluggable), it serves an educational purpose (the code is thoroughly commented), and it provides reusable MLOps utilities and configuration snippets.
The template is an unofficial community project, not an official product of PyTorch Lightning or Hydra. The README notes this explicitly. This matters for teams that need official support contracts or guaranteed compatibility with specific Lightning or Hydra releases.
Project Structure: The Config Directory and Source Layout
The directory structure follows a consistent pattern. The configs/ directory is the central location for all Hydra configurations and is divided into subdirectories for each configurable component.
├── configs <- Hydra configs
│ ├── callbacks <- Callbacks configs
│ ├── data <- Data configs
│ ├── debug <- Debugging configs
│ ├── experiment <- Experiment configs
│ ├── extras <- Extra utilities configs
│ ├── hparams_search <- Hyperparameter search configs
│ ├── hydra <- Hydra configs
│ ├── local <- Local configs
│ ├── logger <- Logger configsThe src/ directory contains training and evaluation code. The tests/ directory contains smoke tests. The scripts/ directory contains utility scripts. The data/ and logs/ directories store datasets and output respectively. The notebooks/ directory is available for Jupyter work.
The .env.example file shows the pattern for environment-specific configuration: rename it to .env (which is excluded from version control by default) and the training script loads it automatically. Hydra configs can reference environment variables with the syntax `${oc.env:MY_VAR}`, which keeps paths and secrets out of the committed configuration files.
Quickstart: Cloning, Installing, and Running the MNIST Example
The README provides a quickstart sequence. Clone the repository, optionally create a conda environment, install PyTorch according to the official instructions for your hardware, then install the remaining requirements.
git clone https://github.com/ashleve/lightning-hydra-template
cd lightning-hydra-template
conda create -n myenv python=3.9
conda activate myenv
pip install -r requirements.txtThe requirements.txt pins the following key dependencies: torch>=2.0.0, torchvision>=0.15.0, lightning>=2.0.0, hydra-core==1.3.2, hydra-colorlog==1.2.0, and hydra-optuna-sweeper==1.2.0. Hydra is pinned to 1.3.2 while Lightning and PyTorch take a minimum version constraint.
The template ships with an MNIST classification example. Running the training script starts this example.
python src/train.pyFor experiment tracking, the requirements.txt lists W&B, Neptune, MLflow, and Comet as commented-out optional dependencies alongside the always-installed CSVLogger and Tensorboard paths. To activate W&B logging, configure the project name in the logger config.
wandb:
project: "your_project_name"
entity: "your_wandb_team_name"Hydra's Command-Line Config Override System
The main technical advantage of using Hydra in this template is the ability to override any configuration parameter from the command line without modifying files. The README shows this working for training hyperparameters.
python train.py trainer.max_epochs=20 model.optimizer.lr=1e-4New parameters can be added inline with the `+` prefix.
python train.py +model.new_param="owo"The same mechanism handles accelerator selection. Switching between CPU, single GPU, and multi-GPU DDP training requires only a trainer argument change rather than code modifications.
python train.py trainer=cpu
python train.py trainer=gpu
python train.py trainer=ddp trainer.devices=4Training with mixed precision adds a precision flag without touching the model code.
python train.py trainer=gpu +trainer.precision=16The configs/experiment/ directory is where versioned experiment configurations live. Each experiment file overrides the relevant hyperparameters for a specific run, creating a git-trackable record of what was trained without duplicating code. This is the primary workflow the template is designed around: define a baseline config, create experiment overrides, and run them with a single command.
Four Reasons the README Says Not to Use It
The README dedicates a section to reasons not to use the template, which is worth reading carefully before committing to it.
First, Lightning and Hydra are still evolving. The README notes that because both frameworks integrate many libraries, things break from time to time. The README links to a page listing currently known bugs.
Second, the template is not adjusted for data engineering. It is designed for training on ready-to-use data. If your workflow involves data pipelines where preprocessing steps depend on each other, the template's configuration structure does not map to those dependencies.
Third, the configuration is overfitted to a simple use case. Adapting it for Lightning Fabric or other non-standard Lightning setups requires effort. The template assumes a straightforward Lightning training loop.
Fourth, it might not support your workflow. The README specifically calls out that you cannot resume a Hydra-based multirun or hyperparameter search if it was interrupted. Additionally, the README includes a specific warning about DDP mode: 'Currently there are problems with DDP mode.' Teams planning to train across multiple GPUs with DDP should check the linked issue before relying on that configuration.
lightning-hydra-template vs. Cookiecutter Data Science
Cookiecutter Data Science is a project template for data science work that organises the full pipeline from raw data to reports and models. The scope difference from lightning-hydra-template is significant: Cookiecutter Data Science covers data acquisition, preprocessing, feature engineering, modelling, and reporting as separate stages. lightning-hydra-template focuses on the training loop and experiment configuration, assuming data is already preprocessed and ready to load.
For research that starts from a public benchmark dataset and focuses on model architecture or training algorithm experimentation, lightning-hydra-template's narrower scope is an advantage because the configuration system is specifically tuned for that use case. For projects where data collection, cleaning, and feature engineering are major concerns, Cookiecutter Data Science's broader structure is more appropriate.
A second difference is the configuration system. Cookiecutter Data Science does not prescribe a configuration management approach. lightning-hydra-template requires Hydra, which has its own learning curve, particularly around how Hydra manages multirun sweeps and output directories.
Licence, Maintenance Status, and Known Issues
The repository does not list a named licence in the metadata. The README does not include a licence section. Before using the template as the basis for a commercial project, teams should verify the licence status directly from the repository, as the metadata reports it as unknown.
The last push to the repository was on 2026-06-11, showing recent activity. The formal releases are older: v2.0.3 was published in September 2023, v2.0.2 in May 2023, and v2.0.1 in March 2023. The gap between the last tagged release and the most recent commit is over three years. This suggests ongoing fixes are applied to the main branch without corresponding tagged releases.
The repository uses GitHub Actions for continuous integration (workflows for tests and code quality). The pyproject.toml configures pytest with strict markers, color output, and a testpaths setting pointing to tests/. Pre-commit hooks are included via the .pre-commit-config.yaml file.
The template uses rootutils for standardizing the project root setup and rich for formatted terminal output during training. These are listed in requirements.txt as non-commented dependencies alongside pytest.
Editorial conclusion
lightning-hydra-template is the right starting point for deep learning researchers who work with ready-to-use datasets and want to run controlled experiments with hyperparameter overrides from the command line. It is the wrong choice for teams building data pipelines that depend on each other, for projects that need to resume interrupted Hydra multiruns, or for any use case where the configuration setup would need significant restructuring beyond simple Lightning training. The template ships with an MNIST example at src/train.py; run that first to confirm the dependencies install cleanly on your hardware before adapting the template to your own model and data.
Frequently asked questions
Can I resume an interrupted Hydra multirun or hyperparameter search with this template?
No. The README explicitly lists this as an unsupported workflow: 'you can't resume hydra-based multirun or hyperparameter search.' This is one of four reasons the README itself gives for not using the template.
Does the template support Weights and Biases and other experiment trackers?
Yes. The README lists experiment tracking integrations for Tensorboard, W&B, Neptune, Comet, MLflow, and CSVLogger. The W&B and other cloud trackers are in requirements.txt as commented-out optional dependencies; you uncomment the one you need and configure its credentials in the logger config file.
What Python and PyTorch versions does this template require?
The requirements.txt specifies Python 3.9 in the conda example and requires torch>=2.0.0, torchvision>=0.15.0, lightning>=2.0.0, and hydra-core==1.3.2. The setup.py lists lightning and hydra-core as the minimum install_requires dependencies.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/ashleve-lightning-hydra-template)