Make the example's __main__ actually run

It claimed to run the pipeline with no engine involved, and could not: the
node bodies it called save and load artifacts, which raise outside a node by
design. Each node is now a thin wrapper over a plain function — make_rows,
train_curve, score — and __main__ calls those, which is the split the sandbox
already demonstrates and the one worth copying.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-26 22:57:36 +02:00
co-authored by Claude Opus 5
parent 4f3eaf950c
commit 8f71b638b6
5 changed files with 45 additions and 19 deletions
+11 -8
View File
@@ -12,9 +12,9 @@ provides a message another requires, never because one imported the other.
from __future__ import annotations
from fluksio import Flow, Port, use
from myresearch.data import augment, prepare
from myresearch.evaluate import evaluate
from myresearch.train import fit
from myresearch.data import augment, make_rows, prepare
from myresearch.evaluate import evaluate, score
from myresearch.train import fit, train_curve
train = Flow(
"train",
@@ -41,8 +41,11 @@ finetune = Flow(
if __name__ == "__main__":
# Run it here, with no engine involved: the decorators changed nothing
# about calling these functions.
dataset = prepare(limit=64)
losses = list(fit(dataset["dataset"], lr=0.05, epochs=5))
print("losses:", [round(step["loss"], 4) for step in losses])
# Run the research here, with no engine involved. Not the node bodies: they
# save and load artifacts, and there is nothing to save to out here. The
# functions they wrap are ordinary Python, which is why they are worth
# keeping separate — the arithmetic stays yours to run by hand.
data = make_rows(limit=64)
print("rows:", len(data["rows"]))
print("losses:", [round(loss, 4) for loss in train_curve(0.05, 5)])
print("score:", score(0.05, 5))