Skip to main content

TrainTrack ML

Quickly run stages of an ML pipeline from the command line

Documentation

ci Code style: black

Welcome to repository and documentation the TrainTrack library. Detailed documentation coming very soon! See here for the documentation of the examples of this library.

Install

TrainTrack is most easily installed with pip:

pip install traintrack

Objective

The aim of TrainTrack is simple: Given any set of self-contained Pytorch Lightning modules, run them in a serial and trackable way.

At its heart, TrainTrack is nothing more than a loop over the stages defined in a pipeline.yaml configuration file. However, it can also handle data processing steps (i.e. non-trainable modules), automatically creates grid scans over combinations of hyperparameters, logs training with (currently) either Tensorboard or Weights & Biases, and can run separate, dependent Slurm batch jobs. It also has an opinionated approach to how data is passed from stage to stage, via Lightning callbacks. In this way, the only code that needs to be written is Lightning modules, all other boilerplate and tracking is handled by TrainTrack.

Example

traintrack uses two ingredients to run and track your training pipeline:

  1. A project configuration file
  2. A pipeline configuration file

It also makes one or two assumptions about the structure of your project. For project MyFirstMNIST, we should structure it as

📦 MyFirstMNIST
┣ 📂 architectures
┣ 📂 notebooks
┣ 📂 configs
┃ ┣ 📜 project_config.yaml
┃ ┗ 📜 my_first_pipeline.yaml
┗ 📂 logs

Note: Only configs/project_config.yaml is a required file. All else is configurable. An example project_config.yaml:

# project_config.yaml

# Location of libraries
libraries:
    model_library: architectures
    artifact_library: /my/checkpoint/directory
    

# The lines you would like/need in a batch script before the call to pipeline.py
custom_batch_setup:
    - conda activate my-favorite-environment
    
# If you need to set up some environment before a batch is submitted, define it here in order of commands to run
command_line_setup:
    - module load cuda
    
# If you need to run jobs serially, set to true
serial: False

# Which logger to use - options are Weights & Biases [wandb], TensorBoard [tb], or [None]
logger: wandb

We can launch a vanilla run of TrainTrack with

traintrack configs/my_first_pipeline.yaml

This trains and performs inference callbacks in the terminal.

A Pipeline

The pipeline config file defines a pipeline, for example:

# my_first_pipeline.yaml

stages:
    - {set: CNN, name: ResNet50, config: test_train.yaml}

which presumes a directory structure of:

📦 MyFirstMNIST
┣ 📂 architectures
┃ ┗ 📂 CNN
┃ ┃ ┣ 📜 cnn_base.py
┃ ┃ ┣ 📜 test_train.yaml
┃ ┃ ┗ 📂 Models
┃ ┃ ┃ ┗ 📜 resnet.py

Again, see this repository for example pipelines in action.

Metadata

Release files for traintrack 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traintrack 0.1.6
File Size Uploaded Provenance Actions
traintrack-0.1.6.tar.gz 14.8 kB Without provenance Details for traintrack-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traintrack 0.1.6
File Interpreter ABI Platform Actions
traintrack-0.1.6-py3-none-any.whl Python 3 none any Details for traintrack-0.1.6-py3-none-any.whl

Total release size: 28.3 kB

Release files / traintrack-0.1.6.tar.gz

Download URL traintrack-0.1.6.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
113e31731b7763b7f985318936e17abe92bf89d5ba44bb7184c0b4d9c2b3c055
BLAKE2b-256 checksum
How to use checksums
8b7c88f9b6652b2f0bb73a6d9f37da92aaef83b540a7db749c2f92b55cfa4098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.10

Release files / traintrack-0.1.6-py3-none-any.whl

Download URL traintrack-0.1.6-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac0a87e4dac024c1e4996f343badd358f5242b096adcc032ded26476cc5b2676
BLAKE2b-256 checksum
How to use checksums
417b615b9679afe4ba043c61465e95fafb13b22e3d2036059d29c3e058490b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.10

Security for traintrack 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page