Human-in-the-Loop ML Training Orchestrator.
Project description
OnTheFly
OnTheFly lets you steer PyTorch training runs live from VS Code — pause, inspect, fork, merge, and export without ever leaving your IDE or sending data to the cloud.
Today, most training is fire-and-forget: you start a long run, wait, and only discover failure cases or weak slices after it finishes. Fixing them means reruns, one-off notebooks, and manual data slicing.
OnTheFly turns that into an interactive loop:
- watch per-sample loss and slices while you train
- pause to inspect hard examples or drift
- fork short-budget specialists on rough regions
- merge improvements back into a single exportable model
All of this runs fully offline in a local VS Code extension — no accounts, no tokens, no external services.
[!IMPORTANT] Project status: Beta. APIs, UI flows, and file formats may change before v1.0. Expect rough edges and please report issues.
When should you use OnTheFly?
OnTheFly is aimed at people who:
- train PyTorch models (classification, regression, etc.) and want more visibility than TensorBoard/print logs
- care about bad slices / drift / outliers and don't want to wait until the run is over to investigate
- prefer a local, offline workflow inside VS Code rather than wiring up cloud dashboards
Getting Started
Install
pip install onthefly-ai
Requirements
- Python ≥ 3.9
- PyTorch ≥ 2.2 (CUDA 12.x optional)
- OS: Linux, macOS, or Windows
- Visual Studio Code
Sessions & storage
Every session is ephemeral in storage: when a new session begins, the previous session’s storage is cleaned up. Exporting a session is equivalent to saving a session.
Quickstart
import torch, torch.nn as nn
from torch.utils.data import DataLoader, TensorDataset
from onthefly import quickstart
# toy dataset
X = torch.randn(4096, 28*28)
y = (X[:, :50].sum(dim=1) > 0).long()
ds = TensorDataset(X, y)
train = DataLoader(ds, batch_size=128, shuffle=True)
val = DataLoader(ds, batch_size=256)
test = DataLoader(ds, batch_size=256)
# tiny model
model = nn.Sequential(nn.Linear(28*28, 64), nn.ReLU(), nn.Linear(64, 2))
opt = torch.optim.Adam(model.parameters(), lr=1e-3)
loss = nn.CrossEntropyLoss()
quickstart(
project="mnist-demo",
run_name="baseline",
model=model,
optimizer=opt,
loss_fn=loss,
train_loader=train,
val_loader=val,
test_loader=test,
max_epochs=1,
do_test_after=True,
)
Don't run this just yet — you'll start training from the dashboard controls instead.
Open the VS Code dashboard
- Open VS Code → Command Palette (
Ctrl/Cmd + Shift + P). - Select the “On the Fly: Show Dashboard” command.
- Select your Python interpreter and training script.
- Press ▶ Run to start/monitor training, inspect clusters, and compare experts.
Features
Mid-training control & visibility
- Start and control training from the VS Code dashboard.
- Stream per-sample loss (optionally grad-norm, margin) with robust quantiles to surface loss tails early.
- Run mid-run health check-ups to detect instability and configuration issues before they cascade.
Fork, specialize, and merge
- Fork short-budget specialists from high-loss tails or residual clusters, then route with a lightweight gate.
- Compare experts side-by-side on target slices.
- Merge via SWA, distillation, Fisher Soup, or adapter fusion; view model lineage (parent/children) before committing.
Data & sessions
- One-click export of indices/rows for any slice to CSV / Parquet / JSON.
- Ephemeral sessions: storage is cleared when a new session begins; exporting is how you save.
- Portable sessions: exported sessions include the final model and can be re-imported to run tests, reports, or further training.
Training backend
- Mirrors training in OnTheFly’s backend for any
torch.nn.Module(including custom ones) and standardDataLoaders. - Deterministic distributed runs, with a surfaced determinism “health check” for monitoring.
- Seamless continuation of training after tests, whether they were triggered automatically or manually.
Manual human-in-the-loop
Instead of trusting a long run and hoping for the best, you keep tight control over when to pause, inspect, fork, and merge — with deterministic actions and evidence in front of you.
What you can do
- Pause/Resume at any time to take a clean snapshot.
- Inspect before acting: View per-sample loss distributions, export subsets for offline analysis.
- Approve or edit plan cards prior to execution.
- Compare experts on target slices.
- Merge on your terms via SWA / Distill / Fisher Soup / adapter fusion.
- Run health check-ups mid-run to validate determinism, gradients, and metrics before committing to longer budgets.
- Export & import sessions knowing that exported sessions include the final model and can later be imported, tested, and trained further.
Typical manual loop
- Pause when drift or a weak slice appears.
- Inspect loss tails, export a subset for a quick notebook check.
- Fork a short-budget specialist for chosen samples, with desired parameters.
- Evaluate on target slices; iterate if needed.
- Merge improvements and resume training.
- Export the session for traceability, or import a prior session to continue training or generate reports.
Method (at a glance)
Train a generalist, detect hard cases, focus on those specialists, learn a gating network, and export a unified MoE for inference. Or, don't use forking at all; simply manage your model development from VS Code without connecting to any externals or cloud.
- Train a compact generalist on all data.
- Hard-sample mining flags high-loss examples online.
- Clustering groups hard samples into candidate regimes.
- Boost rough areas of the loss curve by forking specialists.
- Choose a gating network to unify experts.
- Benchmark fairly against a monolithic baseline with matched compute.
License
This project is licensed under the MIT License – see the LICENSE file for details.
Citation
If you use this project in research, please cite:
@software{onthefly2025,
title = {OnTheFly: Human-in-the-Loop ML Orchestrator},
author = {Luke Skertich},
year = {2025},
url = {https://github.com/KSkert/onthefly}
}
Project details
Release history Release notifications | RSS feed
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 onthefly_ai-0.0.5.tar.gz.
File metadata
- Download URL: onthefly_ai-0.0.5.tar.gz
- Upload date:
- Size: 60.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53fb6d46ad8eb1a5bf81ffd3d7d54ecd0093ed5291d46ad476d7d573990dad2e
|
|
| MD5 |
a557458927e657e38ce5b43aea0fb58d
|
|
| BLAKE2b-256 |
b79bb321aaa4a3c5d4f16084b81c220c2ffbb8c7e021ccda66dca6f2cd1f3c7a
|
File details
Details for the file onthefly_ai-0.0.5-py3-none-any.whl.
File metadata
- Download URL: onthefly_ai-0.0.5-py3-none-any.whl
- Upload date:
- Size: 68.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f736ab298073183283dd7334eef6ddda985ae019878ed5e9185e24d3e22217a7
|
|
| MD5 |
8fb723cbe015a898922fa79b69e4c042
|
|
| BLAKE2b-256 |
7ba4e953dd62f698092e408a4a28df9bc393d7972ca705c1ca295e978d1f2aad
|