Skip to main content

Autotrainer

CI PyPI Python License: MIT Code style: ruff

Run your training loop fast on the hardware you have.

Autotrainer detects your hardware (local GPUs or a SLURM cluster), picks the distribution strategy, applies the throughput wins people forget, and tells you when a run is slow or broken — without touching your lr, loss, schedule, or optimizer.

Works with PyTorch (DDP, SLURM multi-node), TensorFlow/Keras, scikit-learn, XGBoost, and LightGBM through one API.

Install

pip install "autotrainer[torch]"   # PyTorch (recommended)
pip install "autotrainer[all]"     # + TensorFlow, sklearn, XGBoost, LightGBM

Only psutil is required by default; each framework is an opt-in extra (torch, sklearn, tf, boosting, all). Install only what you use.

Use it

Two lines, full training run — infers loss/optimizer/schedule, applies the hardware wins, saves the checkpoint, prints a summary:

import autotrainer

model = autotrainer.train(model, loader, epochs=5, save_path="model.pt")

Or keep your own loop — prepare() returns the same three objects you passed in, now distributed and optimized:

import autotrainer

model, loader, optimizer = autotrainer.prepare(model, loader, optimizer)

for epoch in range(epochs):
    autotrainer.set_epoch(loader, epoch)   # reshuffle each epoch
    ...                                    # your normal training loop

autotrainer.finish()                       # prints the training summary

Then run it. No launcher to configure — on a multi-GPU box prepare() spawns one worker per GPU by itself:

python train.py                  # local: auto-distributes across GPUs
srun autotrainer run train.py    # SLURM multi-node
autotrainer doctor               # check the environment before you burn an allocation
autotrainer ui                   # zero-dependency dashboard for your runs

Why use it

  • Your loop stays yours. No base class, no trainer object, no callback system. Deleting the import leaves a working script.
  • Your hyperparameters are never touched silently. lr, loss, schedule, and optimizer are yours unless you call auto() or train(). optimize=True only does throughput — TF32, cudnn.benchmark, channels_last, workers, AMP, fused optimizers — and prints every change it makes.
  • It's faster. +22% end to end vs torch defaults on a 4-conv net, +123% on optimizer-bound MLPs. Measurements.
  • No launcher to configure. python train.py uses every GPU; under SLURM the auto-spawn stands down so srun autotrainer run behaves.
  • It tells you why the run is bad. MFU and samples/sec, whether the loader is starving the GPU, and NaN / divergence / fp16-overflow named in plain language with the fix.
  • One API across frameworks. PyTorch, TensorFlow/Keras, scikit-learn, XGBoost, LightGBM — most alternatives are PyTorch-only.

Worker counts come from the CPUs you were actually allocated (SLURM_CPUS_PER_TASK, then the affinity mask), so a job granted 8 CPUs of a 128-core node does not spawn 128 workers.

Documentation

Start here

  • Entry points — which function do I call for what.
  • Performance — what the optimizations measurably buy.
  • How it compares — vs Lightning, Accelerate, Ray, torchrun, and when to reach for something else.

Guide

Reference

HPC tip: on shared network filesystems (NFS/Lustre), route the uv cache to local node storage (export UV_CACHE_DIR=/tmp/$USER-uv-cache) and pass --link-mode=copy, or create .venv in /tmp.

Metadata

Release files for autotrainer 0.17.0

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

Source distribution (sdist)

Source distribution for autotrainer 0.17.0
File Size Uploaded
autotrainer-0.17.0.tar.gz 174.6 kB Details

Built distribution (wheel)

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

Total release size: 294.1 kB

Release files / autotrainer-0.17.0.tar.gz

Download URL autotrainer-0.17.0.tar.gz
Size 174.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f737912449a673fb2cfc81be2af4286bf0463d69ca8e7088e10b2037d331b696
BLAKE2b-256 checksum
How to use checksums
3ea7945bdb580ae5e77bf297ee41a887a58dbdd79ef59f46b01d03243846f7b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / autotrainer-0.17.0-py3-none-any.whl

Download URL autotrainer-0.17.0-py3-none-any.whl
Size 119.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da043773bfc12dd99aa6961dc2f585fb5bd0614ce87975cbaf7a261f3df7cb51
BLAKE2b-256 checksum
How to use checksums
7517a53a3f4ab68a0471838d8955a21a050cec4a5620772d248ef56964d67909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.17.0 This release

2 release files

0.16.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

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