wren node: Train in the panel, as a run of wren's training flow
POST/GET /flows/{name}/nodes/{id}/train submit wren_train on the node's
targets, examples and tests and read its latest run (run.for_node,
cause "train"); "Use this model" writes `model` into the draft.
This commit is contained in:
@@ -378,6 +378,8 @@ name of its own, in the node panel's port name field or as
|
||||
| `min_confidence` | empty | the confidence a call needs; empty takes the model's own threshold |
|
||||
| `targets` | empty | by target port, what the model is told of it and how far it is trusted (below) |
|
||||
| `aliases` | empty | your own words, or words the recogniser hears wrong, in the model's: `{"traverse": "living room light", "page too": "patio"}` |
|
||||
| `examples` | empty | for training only, commands to learn beyond the ones wren generates (below) |
|
||||
| `tests` | empty | for training only, commands a new model is scored on (below) |
|
||||
|
||||
Every field of a `targets` entry is optional:
|
||||
|
||||
@@ -427,6 +429,34 @@ it runs without that warning only on ports named and described as there. A
|
||||
and every command goes on to `unhandled`. A model trained with wren goes into
|
||||
the store with `PUT /artifacts` (see the [API](../code/api.md#artifacts)).
|
||||
|
||||
**Train** in the node panel trains a new model for the node as a run of wren's
|
||||
training flow, `wren_train`. It learns the targets wired to the node, as the
|
||||
panel shows them with unpublished edits included, and its `examples`, and it
|
||||
scores the new model on its `tests`. Both are lists in wren's installation
|
||||
format, with targets named by port:
|
||||
|
||||
```json
|
||||
{"state": {"user_location": "kitchen"}, "command": "lights on please",
|
||||
"calls": [["kitchen_light", true]]}
|
||||
```
|
||||
|
||||
A call is `[target, value]`, `[target, value, delay_s]` or, for a read,
|
||||
`[target]`. A test with `"calls": []` is a command the model must pass on. The
|
||||
node never reads either setting when it runs, and wren refuses an example its
|
||||
targets cannot answer before training starts. The panel follows the run and
|
||||
shows the model's exact match, coverage and threshold, and its exact match on
|
||||
the tests, once it ends. **Use this model** sets the new model as `model` in
|
||||
the draft, and publishing puts it live. `POST` and `GET` on
|
||||
`/flows/{name}/nodes/{id}/train` start a training run and read the latest one.
|
||||
|
||||
Training needs wren's `train` extra, which brings JAX, where the run executes:
|
||||
in **Modules** (see [Packages](../code/nodes.md#packages)) or on a worker. List
|
||||
`wren[train] @ https://github.com/stroblme/wren/archive/main.tar.gz` there
|
||||
(an archive, since the engine image has no git). The flow comes from
|
||||
wren and is registered once with `fluksio sync wren.flow`, run from an
|
||||
environment with `wren[train]` and fluksio. Until then Train answers that the
|
||||
flow is missing.
|
||||
|
||||
The command is read in lower case without sentence marks and with number words
|
||||
as digits ("in five minutes" as "in 5 minutes"), as the model was trained.
|
||||
`aliases` are applied before, whole words in any case, and `unhandled` carries
|
||||
|
||||
Reference in New Issue
Block a user