Skip to main content

PyTorch Lightning Project Setup

Project description

LightningTrain

python pytorch lightning hydra

A clean and simple PyTorch Lightning + Hydra projects.

๐Ÿ“Œ Introduction

This repository contains a simple PyTorch Lightning + Hydra project template. It is designed to be a starting point for your own projects. It is based on the PyTorch Lightning.


๐Ÿ“ฆ Main Technologies

PyTorch Lightning - a lightweight PyTorch wrapper for high-performance AI research. Think of it as a framework for organizing your PyTorch code.

Hydra - a framework for elegantly configuring complex applications. The key feature is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line.


๐Ÿ“ Project Structure

The directory structure of new project looks like this:

configs
โ”‚   โ”œโ”€โ”€ data                     <- Data configs
configs
โ”‚   โ”œโ”€โ”€ hydra                    <- Hydra configs
โ”‚   โ”œโ”€โ”€ local                    <- Local configs
โ”‚   โ”œโ”€โ”€ model                    <- Model configs
โ”‚   โ”œโ”€โ”€ paths                    <- Project paths configs
โ”‚   โ”œโ”€โ”€ trainer                  <- Trainer configs
โ”‚   โ”œโ”€โ”€ eval.yaml             <- Main config for evaluation
โ”‚   โ””โ”€โ”€ train.yaml            <- Main config for training
โ”‚
โ”œโ”€โ”€ data                   <- Project data
โ”‚
โ”œโ”€โ”€ logs                   <- Logs generated by hydra and lightning loggers
โ”‚
โ”œโ”€โ”€ notebooks              <- Jupyter notebooks. Naming convention is a number (for ordering),
โ”‚                             the creator's initials, and a short `-` 
โ”‚
โ”œโ”€โ”€ lightningtrain                    <- Source code
โ”‚   โ”œโ”€โ”€ data                     <- Data scripts
โ”‚   โ”œโ”€โ”€ models                   <- Model scripts
โ”‚   โ”œโ”€โ”€ utils                    <- Utility scripts
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ eval.py                  <- Run evaluation
โ”‚   โ””โ”€โ”€ train.py                 <- Run training
โ”‚
โ”œโ”€โ”€ tests                  <- Tests of any kind
โ”‚
โ”œโ”€โ”€ .gitignore                <- List of files ignored by git
โ”œโ”€โ”€ .project-root             <- File for inferring the position of project root directory
โ”œโ”€โ”€ Makefile                  <- Makefile with commands like `make train` or `make test`
โ”œโ”€โ”€ pyproject.toml            <- Configuration options for testing and linting
โ”œโ”€โ”€ requirements.txt          <- File for installing python dependencies
โ”œโ”€โ”€ setup.py                  <- File for installing project as a package
โ””โ”€โ”€ README.md

๐Ÿš€ Quickstart

# clone project
git clone https://github.com/dlwizard/lightningflow.git
cd lightningflow

# create docker container with .devcontainer.json
# or install dependencies locally

# install project as a package
pip install -e .

# run training
lightningtrain_train data.num_workers=16

# run evaluation
lightningtrain_eval data.num_workers=16

๐Ÿ“ Docker container usage instructions

Prerequisites:

Steps:

  1. Clone this repository
  2. Open the repository in Visual Studio Code
  3. press crtl+shift+p and select "Remote-Containers: Reopen in Container"
  4. Wait for the container to build
  5. Open a terminal in Visual Studio Code and run the following commands:
# install project as a package
pip install -e .

# run training
lightningtrain_train data.num_workers=16

# run evaluation
lightningtrain_eval data.num_workers=16


๐Ÿ“ Instructions for PyPi package usage

Prerequisites:

Steps:

  1. python -m venv venv
  2. source venv\Scripts\activate
  3. python3 -m pip install lightningtrain
  4. lightningtrain_train data.num_workers=16
  5. lightningtrain_eval data.num_workers=16

References


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lightningtrain-0.0.4-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page