# ashleve/lightning-hydra-template

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/ashleve-lightning-hydra-template).**

5,303 stars · 759 forks · Python

## Links

- GitHub: https://github.com/ashleve/lightning-hydra-template
- awesome-repositories: https://awesome-repositories.com/repository/ashleve-lightning-hydra-template.md

## Topics

`best-practices` `config` `deep-learning` `hydra` `mlops` `project-structure` `pytorch` `pytorch-lightning` `reproducibility` `template`

## Description

This project is a standardized machine learning experiment boilerplate and project template that combines PyTorch Lightning with the Hydra configuration framework. It provides a structured codebase for organizing deep learning workflows, specifically designed to integrate hierarchical configuration management with distributed training.

The template features a specialized workflow for hyperparameter optimization and batch experiment execution, allowing for automated parameter sweeps without modifying source code. It employs a hierarchical system for managing settings via YAML files and command line overrides to ensure reproducible results across different experiment runs.

The project covers broad capability areas including distributed deep learning training across multiple hardware accelerators, data pipeline encapsulation, and multi-backend experiment logging. It also integrates code quality automation through pre-commit hooks, linters, and formatters, alongside tools for model checkpoint management and evaluation.

## Tags

### Artificial Intelligence & ML

- [PyTorch Lightning Workflows](https://awesome-repositories.com/f/artificial-intelligence-ml/pytorch-lightning-workflows.md) — A structured codebase for deep learning experiments combining PyTorch Lightning for training and Hydra for configuration management.
- [Checkpoint-Based Recovery](https://awesome-repositories.com/f/artificial-intelligence-ml/checkpoint-based-recovery.md) — Provides mechanisms to serialize and restore model training state from checkpoints to resume experiments.
- [Distributed Training Configurations](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training-frameworks/distributed-training-configurations.md) — Offers a specialized configuration for executing deep learning workloads across multiple hardware accelerators using parallel strategies.
- [Distributed Training Orchestration](https://awesome-repositories.com/f/artificial-intelligence-ml/distributed-training-orchestration.md) — Coordinates training workloads across multiple accelerators using data parallel processing and mixed precision.
- [Experiment Tracking](https://awesome-repositories.com/f/artificial-intelligence-ml/experiment-tracking.md) — Implements integrated experiment tracking to log hyperparameters and visualize performance metrics across training runs.
- [Distributed Training](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/distributed-training.md) — Provides built-in support for scaling deep learning model training across multiple compute nodes and hardware accelerators.
- [Experiment Boilerplates](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/experiment-boilerplates.md) — Provides a standardized project layout for organizing data pipelines, model architectures, and training loops.
- [Hyperparameter Sweep Orchestrators](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/training-configuration-management/training-hyperparameter-configurations/hyperparameter-sweep-orchestrators.md) — Automates the search across large hyperparameter spaces using optimization tools to improve model performance. ([source](https://github.com/ashleve/lightning-hydra-template#readme))
- [Training Checkpointers](https://awesome-repositories.com/f/artificial-intelligence-ml/training-checkpointers.md) — Saves training state to disk and allows resuming execution from a checkpoint to continue training. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/tests/test_train.py))
- [Hyperparameter Configurations](https://awesome-repositories.com/f/artificial-intelligence-ml/hyperparameter-configurations.md) — Tracks sets of hyperparameters through dedicated configurations to maintain a history of optimal settings. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/configs/train.yaml))
- [Distributed Mixed-Precision Training](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/machine-learning-training/distributed-and-accelerated-compute/training-acceleration-tools/mixed-precision-training/distributed-mixed-precision-training.md) — Facilitates distributed training using data parallel processing and mixed precision to accelerate model convergence. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/tests/test_train.py))
- [Training and Evaluation Pipelines](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-training-and-tuning/training-frameworks/training-and-evaluation-pipelines.md) — Provides a pipeline to toggle between training and testing phases using configuration flags. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/configs/train.yaml))
- [Hyperparameter Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/model-optimization/training-efficiency/hyperparameter-optimization.md) — Provides automated hyperparameter optimization and parameter sweeps to improve model performance without source code changes.

### Development Tools & Productivity

- [Project Bootstrapping Templates](https://awesome-repositories.com/f/development-tools-productivity/project-bootstrapping-templates.md) — Ships a standardized project boilerplate with predefined directory structures and configurations for machine learning experiments.
- [Hydra](https://awesome-repositories.com/f/development-tools-productivity/configuration-composers/hydra.md) — Integrates the Hydra framework for hierarchical management of hyperparameters and experiment settings via YAML and CLI.
- [CLI Configuration Overrides](https://awesome-repositories.com/f/development-tools-productivity/cli-configuration-overrides.md) — Allows modification of configuration values and experiment presets directly through terminal command-line flags.
- [Command Line Interfaces](https://awesome-repositories.com/f/development-tools-productivity/command-line-interfaces.md) — Maps functions to terminal commands to trigger training and evaluation workflows directly from the shell. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/setup.py))

### Software Engineering & Architecture

- [Hierarchical Configuration Overrides](https://awesome-repositories.com/f/software-engineering-architecture/hierarchical-configuration-overrides.md) — Implements a hierarchical system for managing settings via YAML files and overrides to ensure reproducible runs.
- [Dynamic Object Instantiation](https://awesome-repositories.com/f/software-engineering-architecture/dynamic-object-instantiation.md) — Creates model and data objects at runtime by mapping configuration paths to Python classes.

### Data & Databases

- [Data Pipelines](https://awesome-repositories.com/f/data-databases/data-pipelines.md) — Bundles data downloading, splitting, and transformation logic into reusable modules for consistent dataset handling. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/src/data/mnist_datamodule.py))

### Programming Languages & Runtimes

- [Model Encapsulations](https://awesome-repositories.com/f/programming-languages-runtimes/class-based-architecture/model-encapsulations.md) — Separates model architecture, training logic, and data pipelines into modular classes for reusable workflows.

### System Administration & Monitoring

- [ML Experiment Logging](https://awesome-repositories.com/f/system-administration-monitoring/ml-experiment-logging.md) — Connects training runs to external monitoring platforms for recording hyperparameters and visualizing metrics. ([source](https://github.com/ashleve/lightning-hydra-template/blob/main/README.md))
- [Multi-Backend Metric Exporters](https://awesome-repositories.com/f/system-administration-monitoring/metrics-exporters/multi-backend-metric-exporters.md) — Routes training performance metrics to multiple external tracking frameworks through a unified interface.

### DevOps & Infrastructure

- [Experiment Batch Execution](https://awesome-repositories.com/f/devops-infrastructure/remote-command-execution/batch-command-executions/experiment-batch-execution.md) — Run multiple experiment configurations or random seeds in a single command by iterating through a specified folder. ([source](https://github.com/ashleve/lightning-hydra-template#readme))

### Testing & Quality Assurance

- [Model Evaluation](https://awesome-repositories.com/f/testing-quality-assurance/model-testing/model-evaluation.md) — Includes utilities for evaluating saved model checkpoints against specific datasets to validate performance. ([source](https://github.com/ashleve/lightning-hydra-template#readme))
