@tuned-tensor/cli 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -7
- package/dist/{chunk-4Q54NHKR.js → chunk-4SUXBHIY.js} +1715 -392
- package/dist/chunk-4SUXBHIY.js.map +1 -0
- package/dist/index.js +1910 -356
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.js +147 -49
- package/dist/local-runtime.js.map +1 -1
- package/docs/local-runtime/architecture.md +44 -1
- package/docs/local-runtime/aws-gpu.md +2 -0
- package/docs/local-runtime/decision.md +142 -0
- package/docs/spec-architecture.html +2 -2
- package/docs/spec-workflow.md +18 -3
- package/examples/single-spec/decision/tunedtensor.json +630 -0
- package/package.json +5 -2
- package/training/adapter/src/evaluate.py +14 -7
- package/training/adapter/src/hub_download.py +384 -0
- package/training/adapter/src/model_contract.py +38 -5
- package/training/adapter/src/prefetch.py +26 -32
- package/training/adapter/src/prefetch_dataset.py +116 -0
- package/training/adapter/src/serve.py +42 -12
- package/training/adapter/src/train.py +8 -0
- package/training/decision/pyproject.toml +25 -0
- package/training/decision/src/common.py +127 -0
- package/training/decision/src/evaluate.py +70 -0
- package/training/decision/src/train.py +181 -0
- package/training/decision/uv.lock +1175 -0
- package/dist/chunk-4Q54NHKR.js.map +0 -1
package/README.md
CHANGED
|
@@ -94,8 +94,12 @@ npm link
|
|
|
94
94
|
## Behavior spec workflow
|
|
95
95
|
|
|
96
96
|
`tunedtensor.json` is the source of truth for behavior and training settings.
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
In the shell, `/spec` shows a readable overview grouped into behavior,
|
|
98
|
+
examples, training, evaluation and runtime sections; `/spec <section>` (for
|
|
99
|
+
example `/spec examples`) shows one section in full and `/spec show` prints the
|
|
100
|
+
highlighted JSON. `/spec diff`, `/spec validate`, and `/spec history` complete
|
|
101
|
+
the review, all without a model call. Outside the shell, `tt spec view` and
|
|
102
|
+
`tt spec <section>` print the same readable view. Ask the agent for changes, inspect its proposed
|
|
99
103
|
diff, then press `y` when tt asks (or `/approve` later) to save a validated edit
|
|
100
104
|
with revision history. Pipeline
|
|
101
105
|
runs use the saved spec. See [the spec workflow](docs/spec-workflow.md).
|
|
@@ -226,8 +230,15 @@ that request real execution fail before the child command is dispatched. Real
|
|
|
226
230
|
training remains available through the explicit direct `tt pipeline run` command.
|
|
227
231
|
A changed workspace or spec requires a new review.
|
|
228
232
|
|
|
229
|
-
Useful shell controls include `/help`, `/status`, `/context`, `/
|
|
230
|
-
`/login`, `/cd`, `/clear`, and `/exit`.
|
|
233
|
+
Useful shell controls include `/help`, `/status`, `/context`, `/system`,
|
|
234
|
+
`/model`, `/login`, `/cd`, `/clear`, and `/exit`.
|
|
235
|
+
When the shell opens, the TT logo mark (drawn in the terminal) greets you with the current spec, a
|
|
236
|
+
live machine panel (GPU utilization, VRAM and temperature from `nvidia-smi`,
|
|
237
|
+
CPU, RAM, and free space in the model cache) and whether this machine can
|
|
238
|
+
fine-tune the spec's base model, plus a suggested next step. `/system` refreshes
|
|
239
|
+
that panel and lists every certified base model's verdict. Fit verdicts come
|
|
240
|
+
from the same certified memory profiles as `tt hardware`; a fresh
|
|
241
|
+
`tt hardware` snapshot takes precedence over the quick live check.
|
|
231
242
|
The shell banner and `/context` show the inference selection (`agent
|
|
232
243
|
provider/model`) separately from the workflow model. The managed alias identifies
|
|
233
244
|
inference through the server-selected model. Run `/model` with no arguments to
|
|
@@ -260,18 +271,40 @@ optional `gpu` configuration moves its GPU processes to your AWS instance.
|
|
|
260
271
|
The portable document contract lives in `@tuned-tensor/pipeline-contract`. The
|
|
261
272
|
CLI adds execution planning (step selection) on top of it.
|
|
262
273
|
|
|
263
|
-
|
|
274
|
+
Three local engines share that document version:
|
|
264
275
|
|
|
265
276
|
- **Adapter** (default): LoRA SFT on a certified Hugging Face checkpoint.
|
|
266
277
|
Runs through `tt pipeline run`. Uses `train` / `evaluate` / `compare` with
|
|
267
278
|
`evaluate.with.evaluator: "behavior"`.
|
|
279
|
+
Certified models (`Qwen/Qwen3.5-2B`, Nemotron 3.5 Lightning, Muse Glimmer)
|
|
280
|
+
have a reviewed revision, architecture, and memory profile. Any other
|
|
281
|
+
Hugging Face text model can be trained as **uncertified** by pinning its
|
|
282
|
+
commit; it loads as a causal LM with safetensors weights, no remote code,
|
|
283
|
+
and generic LoRA defaults (override them in `hyperparameters`):
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"base_model": "mistralai/Mistral-7B-Instruct-v0.3",
|
|
288
|
+
"hyperparameters": { "base_model_revision": "<40-char commit SHA>" }
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Pick an instruct/chat variant (the trainer needs a chat template) and check
|
|
293
|
+
hardware fit with `tt doctor`, since TT has no memory profile for it.
|
|
268
294
|
- **Foundation**: from-scratch tokenizer + GPT. Also runs through
|
|
269
295
|
`tt pipeline run`. Uses
|
|
270
296
|
`tokenize` / `pretrain` / `finetune` / optional `rl` plus `bpb`, `chat`, and
|
|
271
297
|
`inference` evaluators. Requires a foundation `tunedtensor.json`
|
|
272
298
|
(`engine: "foundation"`, at least two examples, no `base_model`).
|
|
273
|
-
|
|
274
|
-
|
|
299
|
+
- **Decision**: fine-tunes a small typed decision model
|
|
300
|
+
(`convaiinnovations/laya`, 421M) that answers one choice, yes/no or score
|
|
301
|
+
question per input with a probability per label, instead of generating text.
|
|
302
|
+
Uses the adapter vocabulary (`train` / `evaluate` / `compare`) and runs on
|
|
303
|
+
CPU, Apple MPS or CUDA. Requires `engine: "decision"` and a `decision`
|
|
304
|
+
question; example outputs are labels. See
|
|
305
|
+
[Decision models](docs/local-runtime/decision.md).
|
|
306
|
+
|
|
307
|
+
All engines are spec-driven. `system_prompt`, `guidelines`, and `constraints`
|
|
275
308
|
are compiled into one canonical system instruction, and `examples` supply the
|
|
276
309
|
demonstrated behavior. Adapter training, foundation tokenizer/pretraining,
|
|
277
310
|
chat SFT, optional RL, and evaluation all receive that same compiled
|
|
@@ -427,6 +460,12 @@ tt pipeline run --spec tunedtensor.json --dry-run
|
|
|
427
460
|
tt pipeline run --spec tunedtensor.json
|
|
428
461
|
```
|
|
429
462
|
|
|
463
|
+
`tt models prefetch` shows a progress bar with transfer rate and ETA. Large
|
|
464
|
+
downloads survive flaky networks: TT pins the requested revision to one commit,
|
|
465
|
+
retries interrupted transfers with backoff (`TT_HF_DOWNLOAD_MAX_ATTEMPTS`,
|
|
466
|
+
default 10), and keeps completed files in the Hugging Face cache, so running the
|
|
467
|
+
command again resumes instead of starting over.
|
|
468
|
+
|
|
430
469
|
These commands read runtime and evaluation settings from the core spec. The preview needs
|
|
431
470
|
no GPU or AWS connection. Results return to the local run and model stores:
|
|
432
471
|
|
|
@@ -435,6 +474,83 @@ tt runs report <run-id>
|
|
|
435
474
|
tt models verify local-<run-id>
|
|
436
475
|
```
|
|
437
476
|
|
|
477
|
+
### Train on a Hugging Face dataset
|
|
478
|
+
|
|
479
|
+
Point `dataset_prebuilt` at files in a Hugging Face dataset repo instead of
|
|
480
|
+
local paths. It works like `base_model`: name the repo, pin a commit, and TT
|
|
481
|
+
downloads it into the same Hugging Face cache.
|
|
482
|
+
|
|
483
|
+
```json
|
|
484
|
+
{
|
|
485
|
+
"dataset_prebuilt": {
|
|
486
|
+
"huggingface": {
|
|
487
|
+
"repo": "SetFit/tweet_sentiment_extraction",
|
|
488
|
+
"revision": "0d5359cfbb2470332f2b82e62269cf755e0ac5c3",
|
|
489
|
+
"columns": { "input": "text", "output": "label_text" }
|
|
490
|
+
},
|
|
491
|
+
"training": "train.jsonl",
|
|
492
|
+
"test": "test.jsonl"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
tt datasets prefetch tunedtensor.json # download with progress; rerun to resume
|
|
499
|
+
tt datasets verify tunedtensor.json # offline checksum check of the cached files
|
|
500
|
+
tt pipeline run --spec tunedtensor.json # downloads automatically if still missing
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
- Split paths are files inside the repo and must be JSONL. Parquet and CSV are
|
|
504
|
+
not supported yet.
|
|
505
|
+
- Without `columns`, files must already be TT chat JSONL whose system message
|
|
506
|
+
matches the spec. With `columns`, each record's `input` and `output` fields
|
|
507
|
+
become chat rows that use the spec's instruction. Records missing either
|
|
508
|
+
field are skipped. Evaluation splits keep the first of any duplicate input,
|
|
509
|
+
and training drops inputs that also appear in an evaluation split. The run
|
|
510
|
+
report lists every skipped or dropped count.
|
|
511
|
+
- Without `revision`, TT uses the cached `main` snapshot and records the commit
|
|
512
|
+
it resolved. `tt validate` and `tt datasets prefetch` flag the spec as
|
|
513
|
+
unpinned. Pin the commit for reproducible runs.
|
|
514
|
+
- Runs never contact the Hub after the download. Each run checks every file
|
|
515
|
+
against its content-addressed blob and records the repo, commit, file
|
|
516
|
+
SHA-256s and conversion counts in `run_metadata.dataset_source`.
|
|
517
|
+
- Gated datasets use `HF_TOKEN`, as model downloads do.
|
|
518
|
+
|
|
519
|
+
### Run records and audit
|
|
520
|
+
|
|
521
|
+
`tt pipeline run` prints each stage live with the time since the run started.
|
|
522
|
+
`--verbose` adds training and evaluation process output, and `--quiet` hides
|
|
523
|
+
both. Full logs stay in the run directory either way.
|
|
524
|
+
|
|
525
|
+
Every run report has a `provenance` block recording what produced it:
|
|
526
|
+
|
|
527
|
+
- TT, Node and platform versions, and the digest of the locked Python runtime;
|
|
528
|
+
- where training ran (local, or the AWS instance and region);
|
|
529
|
+
- the spec file and snapshot digests;
|
|
530
|
+
- the base model id, revision and content fingerprint;
|
|
531
|
+
- every dataset file's SHA-256, the compiled training data digest, and the
|
|
532
|
+
evaluation split and seed;
|
|
533
|
+
- the hyperparameters and the training exit code.
|
|
534
|
+
|
|
535
|
+
The run's event log is hash-chained: each event records the previous event's
|
|
536
|
+
hash. When a run completes, TT records the report's SHA-256.
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
tt runs audit <run-id>
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
`tt runs audit` checks the event chain and re-hashes the report, then prints
|
|
543
|
+
the stage timeline with durations and the provenance. Its verdict is
|
|
544
|
+
`verified`, `incomplete` (older TT versions or unfinished runs) or `tampered`.
|
|
545
|
+
`tampered` exits with code 2 and names the edited event or file; removing the
|
|
546
|
+
completion event or emptying the log also counts as tampering.
|
|
547
|
+
|
|
548
|
+
`tt publish` runs the same audit and uploads the summary with the report. It
|
|
549
|
+
refuses tampered evidence. It also stops on unverifiable evidence, such as runs
|
|
550
|
+
from older TT versions or logs with unreadable lines, unless you pass
|
|
551
|
+
`--allow-unverified`. The chain makes edits evident; it is not a signature, so
|
|
552
|
+
anyone with write access to the store can rewrite the whole log.
|
|
553
|
+
|
|
438
554
|
Serving still runs on the machine executing `tt serve` and requires a local
|
|
439
555
|
Linux/CUDA GPU, even when training used AWS:
|
|
440
556
|
|