TinyExp
Simple experiment management for PyTorch.
TinyExp is built around one idea: your configured experiment is your entrypoint.
Instead of splitting config, launcher, and execution across many files, TinyExp keeps them together in one experiment definition so iteration stays fast and predictable.
What you get in practice:
- Experiment-centered configuration (Hydra/OmegaConf)
- CLI overrides without rewriting code
- Keep your training loop close to plain PyTorch
- Run the same experiment definition from local debug to distributed launch
Why TinyExp
TinyExp focuses on simple, maintainable experiment management:
- Your experiment code stays readable.
- Your config stays structured and easy to override.
- Your execution path stays consistent as experiments grow.
Design Philosophy
TinyExp is intentionally light.
It is not trying to be a heavy trainer framework that owns your epoch loop, callback system, or full runtime lifecycle. Instead, it focuses on a smaller goal:
- keep the experiment itself as the main entrypoint
- keep the training loop in user space
- make configuration and launch behavior explicit
- expose shared capabilities through focused
XXXCfgcomponents - provide thin helpers rather than framework-owned control flow
- treat examples as reusable recipes, not just demos
In short, TinyExp should help you write less experiment plumbing, not less experiment logic.
For a longer explanation, see docs/philosophy.md.
Quick Start (1 Minute)
Option A: Install with pip and use import-based entrypoint
pip install tinyexp
from tinyexp import store_and_run_exp
from tinyexp.examples.mnist_exp import Exp
store_and_run_exp(Exp)
python your_exp.py
python your_exp.py dataloader_cfg.train_batch_size_per_device=16
Option B: Run the bundled example from source (for development)
git clone https://github.com/HKUST-SAIL/tinyexp.git
cd tinyexp
make install
uv run python tinyexp/examples/mnist_exp.py
Common Commands
Run MNIST with config override:
uv run python tinyexp/examples/mnist_exp.py dataloader_cfg.train_batch_size_per_device=16
Print all available configs:
uv run python tinyexp/examples/mnist_exp.py mode=help
Print all configs plus your overrides:
uv run python tinyexp/examples/mnist_exp.py mode=help dataloader_cfg.train_batch_size_per_device=16
Worker processes are launched according to the launcher config: launcher=ray spawns Ray workers from the driver
process, while launcher=mp runs in the current process. The bundled examples default to launcher=ray, so when
using an external multi-process launcher such as torchrun or accelerate launch, override it explicitly:
uv run torchrun --standalone --nproc-per-node 2 tinyexp/examples/mnist_exp.py launcher=mp
The mode config selects what to execute: train, val, run, or help. mode=run is for general
distributed programs without dataloaders — with launcher=ray, no dataloader CPUs are reserved (1 CPU per worker).
Run a command with TinyExp launch helpers after installing the package:
tinyexp-run-with-redis -- python your_exp.py redis_cfg.redis_cache_enabled=true
tinyexp-run-with-ray-cluster --node-count 2 --head-addr 10.0.0.1 -- python your_exp.py
Example Experiments
- MNIST baseline:
tinyexp/examples/mnist_exp.py - ImageNet ResNet-50:
tinyexp/examples/resnet_exp.py - Distributed Monte Carlo pi (non-DL,
mode=run):tinyexp/examples/pi_exp.py
For ImageNet example:
export IMAGENET_HOME=/path/to/imagenet
uv run python tinyexp/examples/resnet_exp.py
For the pi example (Ray workers all-reduce their sample counts, no dataloader involved):
uv run python -m tinyexp.examples.pi_exp pi_cfg.total_samples=100000000 ray_cfg.ray_num_worker=4
How It Works
- Define an experiment class by inheriting
TinyExp. - Keep model/data/optimizer/scheduler config in nested dataclasses.
- Implement
run()(and train/eval helpers) in the same experiment definition. - Launch the script and override config from CLI when needed.
This gives you a single, explicit place to manage experiment behavior.
Development
Install environment and hooks:
make install
Run checks:
make check
Run tests:
make test
Build docs:
make docs-test
Build package:
make build
Release:
make release VERSION=0.0.4
Documentation
- Docs site: https://zengarden.github.io/TinyExp/
- API/module overview:
docs/modules.md
Contributing
PRs and issues are welcome. See CONTRIBUTING.md.
License
MIT License. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinyexp-0.1.1.tar.gz.
File metadata
- Download URL: tinyexp-0.1.1.tar.gz
- Upload date:
- Size: 53.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a2d85cf308943a6beb88d8ac7f344f72b5fde034b8c70f336a613452307432f
|
|
| MD5 |
f4231c48af13d4bf606af9f51d652013
|
|
| BLAKE2b-256 |
66321f228eb18e154f0811927f47ed63570ffce9448d4ea8317c8c4723fd4aee
|
File details
Details for the file tinyexp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tinyexp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 46.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e6d6148ed6654cdee4e78269652e6af6d23bad2b31e2f29e2ad3fc8707c22c8
|
|
| MD5 |
03694b4fe597e64479e8bcc8001c2b58
|
|
| BLAKE2b-256 |
365395161b92be179e32639cf463f5e6216891b024f3a9e599b06fb9b725446c
|