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
+6 -1
View File
@@ -8,6 +8,11 @@ import fluksio
from fluksio import Port, node
def score(lr: float, epochs: int) -> float:
"""How good the model came out, with no Fluksio in it."""
return round(1 - lr / (1 + epochs), 4)
@node(requires=["weights"], provides=Port("score", "float"))
def evaluate(weights):
"""Score the model, returning the number rather than a dict.
@@ -16,4 +21,4 @@ def evaluate(weights):
to a bare return: the generated node wraps it in the message it belongs to.
"""
trained = json.loads(open(fluksio.load_artifact(weights)).read())
return round(1 - trained["lr"] / (1 + trained["epochs"]), 4)
return score(trained["lr"], trained["epochs"])