A visual, Unreal-Blueprints-style node-graph editor for building and launching ML training runs.
Project description
ModuLearn
A visual, Unreal-Blueprints-style node-graph editor for building and launching machine-learning training runs. Drop Dataset → Model → Train nodes on a canvas, wire hyperparameters, loss and feature transforms into them, hit ▶ Train, and watch the learning curve live on the graph. No forms, no drift between the UI and the code it runs.
ModuLearn is a working name — you assemble training runs from modular nodes and learn from the live curve. Rename the package/repo freely; nothing depends on the name.
Why
Most training UIs are flat forms that slowly rot out of sync with the code behind
them. ModuLearn inverts that: your Python is the single source of truth. You declare
what you can train once, in a Registry, and the entire editor — palette, typed
wiring rules, live validation, launch — is generated from it. Wire something the
backend can't accept and it simply won't connect.
Install
pip install -e . # fastapi + uvicorn + pydantic
modulearn demo # serve the bundled editor at http://localhost:8000
modulearn demo is a complete, dependency-free editor (its "trainer" is a toy
loss curve) so you can click around immediately. Once you've built your own app,
serve it the same way:
modulearn run myproject.py # serves the `app` you built with create_app
modulearn run myproject.py:editor # ...or a differently-named app / factory
modulearn --help
Swap on_train for your real training loop and nothing else changes. (The
equivalent source file lives at examples/quickstart.py
if you'd rather run it directly with python.)
The whole integration is two things
from modulearn import Registry, Param, create_app
reg = Registry()
reg.add_dataset("iris", title="Iris", kind="tabular",
features=[...], targets=["species"])
reg.add_model("mlp", title="MLP", requires_kind="tabular",
params=[Param("hidden", "hidden layers", "int_list", [64, 32])])
reg.add_hyperparameter("lr", label="learning rate", default=1e-3, min=1e-6, max=1)
reg.add_loss([Param("loss", "kind", "enum", "mse", choices=["mse", "cross_entropy"])])
def on_train(compiled, reporter):
# compiled.dataset, .model, .model_params, .hyperparameters, .loss_params, .transforms
reporter.state(epochs=100)
for e in range(100):
reporter.metric(epoch=e, train=..., val=...) # drives the live chart
reporter.state(epoch=e, best_val=...)
reporter.state(phase="done", test_score=...)
app = create_app(reg, on_train, title="My Project")
- A
Registry— declare datasets, models, hyperparameters, a loss, and optional feature transforms. Each hyperparameter you add automatically grows a matching, type-checked input on the Train sink. on_train(compiled, reporter)— your training loop.compiledis a fully-validatedCompiledGraph;reporterpublishes progress the editor polls (see the state contract below).
How it fits together
registry.py ── you declare nodes ──► catalog (GET /api/nodes)
│ │
▼ ▼
compiler.py ◄── canvas JSON ──────── static/ (custom canvas engine)
│ type-checks every wire, runs semantic checks
▼
CompiledGraph ──► your on_train(compiled, reporter) ──► runs/<id>/{state,metrics}.json
│
editor polls ◄─┘ (live panel + chart)
- Typed ports. Links carry a family (
dataset,model,loss,run) or a field-specific scalar subtype (scalar/lr), so a learning-rate value fits thelrinput and neverepochs— enforced both client-side and in the compiler. - All-or-nothing compile.
compile_graphcollects every structural, type and semantic error and raises them together, so the UI flags all bad wires at once. - Composable transforms. Chain
Dataset → Transform → … → Model; the compiler walks the chain intocompiled.transforms. Mark a transformlive=Falseto show it in the palette but have the compiler refuse it until your backend is ready. - Stateless live window. Training runs in a background thread and persists to
runs/<id>/. Closing the browser never stops a run; reopening shows true state.
The state contract
Your on_train reports through reporter, and the editor reads these keys:
| call | keys the UI understands |
|---|---|
reporter.state(**kw) |
phase (running/done/error), epoch, epochs, best_val, test_score, error |
reporter.metric(**row) |
epoch, train, val → the live learning curve |
Anything else you write is stored and returned by the API, just not charted.
Editor niceties
- Searchable palette with collapsible category dropdowns;
⌘K//to focus, Enter to drop the first match. - Wires colored by type, with flowing pulses that speed up on the edges feeding a running Train node; ports glow while you drag a compatible connection.
- Canvas persists to
localStorage; reload/fork any past run's blueprint. - All motion respects
prefers-reduced-motion.
Layout
modulearn/
registry.py the declarative surface your app fills in
compiler.py graph JSON -> validated CompiledGraph (pure, unit-testable)
server.py create_app(): FastAPI factory + background job runner
cli.py the `modulearn` command (demo / run)
demo.py the app `modulearn demo` serves
static/ graph.html, graph.js (app), graph-engine.js (canvas engine)
examples/
quickstart.py a complete, dependency-free editor
License
MIT (see LICENSE). The canvas node-graph engine
(static/graph-engine.js) is our own, built from scratch — no third-party
graph library.
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 modulearn-0.1.1.tar.gz.
File metadata
- Download URL: modulearn-0.1.1.tar.gz
- Upload date:
- Size: 53.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8331a7016697537a4699c82240427d7dab0885bb5075e2206895db46e5090fe
|
|
| MD5 |
18b93d758e21f392222ddc14920e3292
|
|
| BLAKE2b-256 |
c31f0a33299b45df9124082d2c278039208076b41ee270c651af1dfcd6a651e6
|
File details
Details for the file modulearn-0.1.1-py3-none-any.whl.
File metadata
- Download URL: modulearn-0.1.1-py3-none-any.whl
- Upload date:
- Size: 44.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e18588aaaffa9dc8a944701d7409981f01802bc632471a514286a251437adda
|
|
| MD5 |
9aa223e87c1bf4dbbb6176538079bce0
|
|
| BLAKE2b-256 |
20b0fadc9ec45a8c9980077c2be6c7e7e2a33802ecaf7a60ec1faaabf144020c
|