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

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file lightningtrain-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: lightningtrain-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for lightningtrain-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4e81bc4b1b23e44b12a5a57318276ec080a3937e460ab69a673b6ca6a216da92
MD5 44378c70fee72dcc18267c60e76d0e58
BLAKE2b-256 b9ba3f82fd4f5cb3d4c4b9fcb5c0ea812137eda8cd01e6c053ed825b6bed9e0c

See more details on using hashes here.

Supported by

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