Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 1.96 KB

File metadata and controls

93 lines (61 loc) · 1.96 KB

Pytorch Lantern Template

Project template to be used together with pytorch-lantern.

Usage

See pytorch-lantern for instructions.

Code structure

What each directory in the newly-initialized project contains:

data

Problem formulation in a natural (human-readable) form. Datastreams for training and evaluation.

  • Splits data in train / early_stopping / compare
  • Augments data
  • Create informative batches (oversample, stratify, etc)
  • Works with the natural format of the examples
  • Contains train/compare and train/early stopping splits as .json files.

package

Helper functions for running inference and downloading model weights if they are not packaged.

package/model

Contains the model architecture as well as functions to convert the data from human-readable to model-readable.

  • Preprocessing natural data into model-interpretable data
  • Model
  • Predictions (model output representation with helper functions)
  • Loss
  • Prediction visualization

operations

Operations are scripts that are run via the guild CLI that saves artefacts from the run such as model checkpoints.

These often include:

  • guild run train
  • guild run retrain model=xyz
  • guild run evaluate model=xyz

Development

Install dev dependencies like cookiecutter.

poetry install

Setup test environment

./test/create.sh

Download and prepare dataset

./test/prepare.sh

Run tests in any order

./test/run.sh
./test/test.sh

It can be useful to chain create and run when developing

./test/create.sh && ./test/run.sh

or create and prepare:

./test/create.sh && ./test/prepare.sh

Common issues

You cannot activate two environments at the same time. You should not have the outer template environment activated (i.e. poetry shell) when running the development scripts above.