Production-Grade Training Guardrails for PyTorch
Reproducible • Debuggable • Distributed • Efficient
TrainKeeper is a minimal-decision, high-signal toolkit for building robust ML training systems. It adds guardrails inside your training loops without replacing your existing stack (PyTorch, Lightning, Accelerate).
⚡️ Why TrainKeeper?
Most failures happen silently inside execution loops: non-determinism, data drift, unstable gradients, and inconsistent environments. TrainKeeper solves this with zero-config composable modules.
- 🔒 Zero-Surprise Reproducibility: Automatic seed setting, environment capture, and git state locking.
- 🛡️ Data Integrity: Schema inference and drift detection caught before training wastes GPU hours.
- 🚅 Distributed Made Easy: Auto-configured DDP and FSDP with a single line of code.
- 📉 Resource Efficiency: GPU memory profiling and smart checkpointing that respects disk limits.
📦 Installation
pip install trainkeeper
🚀 Quick Start
Wrap your entry point to effectively "freeze" the experimental conditions:
from trainkeeper.experiment import run_reproducible
@run_reproducible(auto_capture_git=True)
def train():
print("TrainKeeper is running: Experiment is now reproducible.")
if __name__ == "__main__":
train()
✨ Features at a Glance
1. Distributed Training (DDP & FSDP)
Stop fighting with torchrun.
from trainkeeper.distributed import distributed_training, wrap_model_fsdp
with distributed_training() as dist_config:
model = MyModel()
model = wrap_model_fsdp(model, dist_config) # FSDP with auto-wrapping!
2. GPU Memory Profiler
Find leaks and optimize batch sizes automatically.
from trainkeeper.gpu_profiler import GPUProfiler
profiler = GPUProfiler()
profiler.start()
# ... training loop ...
print(profiler.stop().summary())
# Output: "Fragmentation detected (35%). Suggestion: Empty cache at epoch end."
3. Interactive Dashboard
Explore experiments, compare metrics, and analyze drift.
pip install trainkeeper[dashboard]
tk dashboard
🔗 Links
- GitHub Repository: mosh3eb/TrainKeeper
- Full Documentation: Read the Docs
Metadata
Release files for trainkeeper 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trainkeeper-0.3.0.tar.gz | 74.8 kB | Without provenance | Details for trainkeeper-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trainkeeper-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for trainkeeper-0.3.0-py3-none-any.whl |
Total release size: 164.0 kB
Release files / trainkeeper-0.3.0.tar.gz
| Download URL | trainkeeper-0.3.0.tar.gz |
|---|---|
| Size | 74.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7171b2fadea78ce22e81687eb50e71d0d2db7c7020caf4b0b7fb383d19e2efbd
|
|
BLAKE2b-256 checksum How to use checksums |
d0791d585ac7251bb43524c7fc6956838f6e38b478a9b8f0ff35f04deaa6ac7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|
Release files / trainkeeper-0.3.0-py3-none-any.whl
| Download URL | trainkeeper-0.3.0-py3-none-any.whl |
|---|---|
| Size | 89.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
101785e81e7f1f90fb7beea341b878f040e3f00f48298b39af67971259da2401
|
|
BLAKE2b-256 checksum How to use checksums |
5df2408894183492623fb955e56eb784b620d21faabc6eecc721eb0b5ed7e66e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.0
|
Security for trainkeeper 0.3.0
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.