Open-source project
ashleve/lightning-hydra-template avatar
ashleve/lightning-hydra-template

Lightning-Hydra-Template: A Scaffold for PyTorch Lightning Experiments, Not a Framework

PyTorch Lightning + Hydra. A very user-friendly template for ML experimentation. ⚡🔥⚡

5,343 stars755 forksPythonLicense varies

At a glance

What is it?
The repository combines PyTorch Lightning with Hydra to cut configuration boilerplate for model prototyping. It is a community template with a narrow intended use case, and the README is candid about where it stops fitting.
Who is it for?
Adopt it if you are starting a single-model training project on ready-to-use data and want Hydra config composition plus Lightning training loops wired together from day one. Do not adopt it if you need interdependent data pipelines, Lightning Fabric, or resumable multirun sweeps, since the README lists all three as out of scope.
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 96 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 September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The boilerplate problem it targets, and the users it assumes

Every PyTorch project starts with the same chores: a training loop, a validation loop, checkpoint handling, a logger, and a way to change hyperparameters without editing source. PyTorch Lightning supplies the loop and the trainer. Hydra supplies hierarchical configuration with command line overrides. The gap between them is glue code, and this repository is that glue, packaged as a GitHub template you initialize with the Use this template button.

The README states the intended audience indirectly through its three reasons to use it: saving on boilerplate, serving as a learning resource because the code is thoroughly commented, and acting as a reference collection of MLOps tools and snippets. The users it assumes are people prototyping models on data that is already prepared. The README says the template is not really adjusted for building data pipelines that depend on each other, and recommends it instead for model prototyping on ready-to-use data. That is a narrower scope than the topic list suggests. Topics include mlops and reproducibility, but the maintainers describe an unofficial community project, not a production platform.

How Hydra composition and config instantiation remove the wiring code

The mechanism is config instantiation. Instead of importing a model class and constructing it in train.py, the training script reads a Hydra config node and instantiates the object named there. The configs directory is organized by object type: model, data, callbacks, logger, trainer, paths, extras, and hparams_search. Each subdirectory holds YAML files that describe one variant of that object. The main configs train.yaml and eval.yaml select defaults, and experiment configs override chosen hyperparameters so a run can be version controlled as a file rather than a shell history.

Data flow follows the same pattern. Hydra composes the config tree, the script instantiates the datamodule and model from it, Lightning's Trainer runs the loop, and loggers write to a dynamically generated folder structure under logs. Because the object graph is resolved from configuration, adding a new model or dataset means adding a config file and a class, not editing the training script. The README frames this as minimal boilerplate through automating pipelines with config instantiation.

The trade-off is that indirection. A reader cannot follow a call stack from train.py to the loss function without opening YAML. For a team that already knows the project, that is a small cost. For someone debugging at 2am, it is a real one, and it is the price of the flexibility the template buys.

Getting a run started: the commands and config keys the README exposes

The README documents the workflow as four steps and points to train.py and eval.py under src as the entry points. Training is launched through the main training config, and the standard Hydra override syntax applies, so a run that changes a single config value does not require a code edit. Evaluation uses the parallel eval.yaml config and src/eval.py.

Environment variables are handled through a .env.example file, which the project structure lists as the example for storing private environment variables. That matters because logger configs for W&B, Neptune, Comet and MLFlow all need credentials, and the template's convention is to keep them out of version control. The .gitignore and .pre-commit-config.yaml files are part of the scaffold, with pre-commit hooks configured for code style tools including Black and isort, both of which appear as badges in the README.

Hyperparameter search is described as effortless through Hydra plugins such as Optuna Sweeper, with configs living in the hparams_search directory. I cannot confirm the exact sweeper invocation from the material provided, so treat that directory as the starting point and read the Hydra Optuna Sweeper documentation for the command form. The same caution applies to the precise train.py invocation flags beyond standard Hydra overrides.

The limitations the maintainers list themselves

The README's why you might not want to use it section is unusually direct, and it should be read before adoption. First, things break from time to time. Lightning and Hydra are still evolving and integrate many libraries, and the README points readers to the repository's bug label list for currently known problems. A template that tracks two fast-moving dependencies inherits both upgrade calendars.

Second, it is not adjusted for data engineering. Interdependent data pipelines are explicitly out of scope. If your work is mostly ingestion, cleaning and joins, this scaffold solves a problem you do not have yet.

Third, it is overfitted to simple Lightning training. The README says you might need to put some effort into adjusting it for different use cases, naming Lightning Fabric as an example. Fabric users get a different programming model, and the config instantiation pattern here assumes a Trainer.

Fourth, workflow support has a hard boundary: you cannot resume Hydra-based multirun or hyperparameter search. That is a concrete failure mode, not a vague caveat. A sweep that dies partway through is a sweep you restart, and the README states this plainly.

Where the release cadence and maintenance cost land

The most recent release listed is v2.0.3 from September 2023, following v2.0.2 in May 2023 and v2.0.1 in March 2023. The repository's last push timestamp is later, so work continues on main between tagged releases, but the tag history shows a project that versions deliberately rather than continuously. For a template, that is reasonable: you copy it once and then own your copy.

That ownership is the real maintenance cost. Once you initialize a repository from the template, upstream fixes do not reach you automatically. You either re-diff against the template or vendor the parts you use. The README leans into this by describing the repository as a reference for utilities, which is the honest framing: you are expected to take pieces, not to track a dependency.

The upgrade cost concentrates in the two upstream frameworks. A Lightning 2.x to 3.x style change or a Hydra 1.3 to 2.x change would require touching the trainer and logger configs and possibly the instantiation logic. The README's own warning about breakage is the maintenance estimate you should budget against.

Licence status: what the repository metadata and the README disagree on

The repository metadata supplied here lists the licence as unknown. The README carries a licence badge pointing at MIT and links to a license section in the repository. Those two signals conflict, and the conflict matters because the template instructs users to generate a new repository from it, which is redistribution.

I cannot resolve the discrepancy from the material available, and this is not legal advice. The practical step is to open the LICENSE file in the repository and confirm the identifier before you build anything you intend to distribute or keep closed. If the file is absent, the default position in most jurisdictions is that no licence is granted, which would make copying the code into a new repository legally ambiguous regardless of what a badge says. Treat the badge as a claim to verify, not as the answer.

What to use instead when the template does not fit

For projects where the training loop is not the hard part, a plain PyTorch Lightning project with a small YAML or dataclass config is a better fit. You lose Hydra's composition and command line overrides, and you gain a call stack you can read top to bottom. The difference is not quality, it is where the complexity sits.

If you need interdependent data pipelines, a workflow orchestrator such as Airflow, Dagster or Prefect addresses that layer directly. Those tools schedule and retry tasks with dependencies; this template instantiates model and data objects from config and runs one training job. Comparing them is a category error, but it is the comparison people make when they see mlops in the topic list.

If you want Lightning Fabric rather than the Trainer, a Fabric example project is the closer starting point, since the README already flags the config setup as built around simple Lightning training. And if your main need is hyperparameter search with resumability, a tool built around that requirement will serve you better than a template that documents the inability to resume multirun as a known constraint.

Editorial conclusion

Adopt it if you are starting a single-model training project on ready-to-use data and want Hydra config composition plus Lightning training loops wired together from day one. Do not adopt it if you need interdependent data pipelines, Lightning Fabric, or resumable multirun sweeps, since the README lists all three as out of scope. Before committing, verify the licence situation, since the repository metadata supplies no licence identifier even though the README badge points at MIT, and check the open bug label list for breakage in your Lightning and Hydra versions.

Official sources

  1. ashleve/lightning-hydra-template on GitHub
  2. Issues
  3. README
  4. Releases
Community notes

Community notes