Skip to main content

Lightweight framework for structuring arbitrary reproducible neural network learning procedures using PyTorch.

Project description

https://codecov.io/gh/kijanac/luz/branch/main/graph/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg

Lightweight framework for structuring arbitrary reproducible neural network learning procedures using PyTorch.

PyTorch code can easily become complex, unwieldy, and difficult to understand as a project develops. Luz aims to provide a common scaffold for PyTorch code in order to minimize boilerplate, maximize readability, and maintain the flexibility of PyTorch itself.

The basis of Luz is the Runner, an abstraction representing batch-wise processing of data over multiple epochs. Runner has predefined hooks to which code can be attached and a State which can be manipulated to define essentially arbitrary behavior. These hooks can be used to compose multiple Runners into a single algorithm, enabling dataset preprocessing, model testing, and other common tasks.

To further reduce boilerplate, the Learner abstraction is introduced as shorthand for the extremely common Preprocess-Train-Validate-Test algorithm. Simply inherit luz.Learner and define a handful of methods to completely customize your learning algorithm.

Two additional abstractions are provided for convenience: Scorers, which score (i.e. evaluate) a Learner according to some predefined procedure, and Tuners, which tune Learner hyperparameters. These abstractions provide a common interface which makes model selection a two-line process.

Getting Started

Installing

From pip:

pip install luz

From conda:

conda install -c conda-forge -c pytorch -c kijana luz

Documentation

See documentation here.

Examples

See example scripts in Examples.

Authors

Ki-Jana Carter

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

See CONTRIBUTING.

Project details


Download files

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

Source Distribution

luz-10.2.2.tar.gz (23.6 kB view hashes)

Uploaded Source

Built Distribution

luz-10.2.2-py3-none-any.whl (26.0 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