@tuned-tensor/cli 0.24.0 → 0.26.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 CHANGED
@@ -72,7 +72,7 @@ npm install -g --ignore-scripts @tuned-tensor/cli
72
72
  tt --version
73
73
  ```
74
74
 
75
- Upgrade later with `tt upgrade`. Uninstall with `npm uninstall -g @tuned-tensor/cli` (add
75
+ `TT` works the same as `tt`. Upgrade later with `tt upgrade`. Uninstall with `npm uninstall -g @tuned-tensor/cli` (add
76
76
  `--prefix ~/.local` if the curl installer used that prefix).
77
77
 
78
78
  Node.js 22.19.0 or newer is required. Training additionally needs
@@ -95,7 +95,7 @@ npm link
95
95
 
96
96
  `tunedtensor.json` is the source of truth for behavior and training settings.
97
97
  In the shell, `/spec` shows a readable overview grouped into behavior,
98
- examples, training, evaluation and runtime sections; `/spec <section>` (for
98
+ dataset, examples, training, evaluation and runtime sections; `/spec <section>` (for
99
99
  example `/spec examples`) shows one section in full and `/spec show` prints the
100
100
  highlighted JSON. `/spec diff`, `/spec validate`, and `/spec history` complete
101
101
  the review, all without a model call. Outside the shell, `tt spec view` and
@@ -176,21 +176,22 @@ the agent:
176
176
  ```text
177
177
  tt v0.15.0
178
178
  agent tunedtensor/managed · workflow model base
179
- ctrl+c stop/clear · ctrl+d exit · /help commands · tab complete
179
+ tt › What would you like to work on?
180
+ /help commands · ctrl+c stop · ctrl+d exit
180
181
 
181
- Ask TT anything. Known commands run directly.
182
182
  › What happened in my latest training run?
183
183
  › runs list
184
184
  ```
185
185
 
186
- Ordinary sentences go through the locally orchestrated model session. The
186
+ Known commands such as `runs list` run directly; tab completes them. Ordinary
187
+ sentences go through the locally orchestrated model session. The
187
188
  model has no shell or general filesystem tool. It can read and propose reviewed
188
- edits to an existing spec, or prepare one new folder directly beneath the shell's current working directory with a validated
189
- `tunedtensor.json`, or prepare a local pipeline dry-run sealed to the reviewed
189
+ edits to an existing spec, or prepare a validated `tunedtensor.json` in the shell's current working directory
190
+ when none exists, or prepare a local pipeline dry-run sealed to the reviewed
190
191
  workspace and spec contents. Writes and pipeline previews wait for your approval: after the
191
192
  answer, tt shows the proposal and asks inline, where `y` approves, `n` rejects and `Esc`
192
193
  leaves it pending for a later `/approve` or `/reject`. Any other key is ignored. The tools refuse path
193
- traversal, symlinked workspace roots, overwriting a new-project target, unsupported spec
194
+ traversal, symlinked workspace roots, overwriting an existing spec, unsupported spec
194
195
  fields, cloud pipeline targets, and spec changes after review. Known CLI
195
196
  commands such as `runs list`, `doctor`, and `models list` still execute directly.
196
197
  Prefix a command with `:` when you want to make that intent explicit.
@@ -205,7 +206,35 @@ search public Hugging Face model or dataset metadata for foundation and
205
206
  fine-tuning discovery. A Hub search sends only the search query to
206
207
  `huggingface.co`; it uses no Hugging Face token, downloads nothing, and omits
207
208
  model-card and dataset-card text. Search results are discovery metadata, not a
208
- guarantee that a model or dataset is compatible with a TT workflow.
209
+ guarantee that a model or dataset is compatible with a TT workflow. The agent
210
+ can inspect a public dataset's exact JSONL/Parquet filenames, sizes, revision,
211
+ and declared columns/splits before proposing a download. Declared schema comes
212
+ from dataset-card metadata; it is not validation of the file contents.
213
+
214
+ To reuse a download, ask “Which datasets have we downloaded?” followed by
215
+ “Use CodeAlpaca in this spec for fine-tuning.” The agent can list TT-recorded
216
+ local datasets and inspect actual Parquet columns/row counts or sampled JSONL
217
+ fields, plus two bounded sample rows. It proposes a `dataset_prebuilt` pointer
218
+ with the cached revision, training file, separate validation/test file and
219
+ column mapping. Approval saves the edit; listing and inspection need no
220
+ download or approval. Existing examples and model settings stay in the spec,
221
+ but prebuilt data supplies the training rows instead of automatically mixing
222
+ in the inline examples. Samples do not establish full dataset quality, and a
223
+ download with only a training split still needs distinct held-out data.
224
+
225
+ When a conversation approaches the model's context budget, TT automatically
226
+ summarizes earlier turns using Pi and the selected model, and shows progress.
227
+ The trigger reserves the full reply allowance plus 4,096 tokens for protocol
228
+ headroom; it does not apply an additional percentage reserve. Usage measured
229
+ before a summary is ignored, while new provider usage calibrates the next
230
+ trigger, including after resume.
231
+ The summary preserves goals, decisions and action outcomes and is saved for
232
+ `/resume`; recent exchanges remain in context. Summarization uses an additional
233
+ model request (or several for unusually long histories). The transcript stays
234
+ in local history subject to the existing storage limits, and pending approvals
235
+ remain intact. If the current request is still too large, summarization fails,
236
+ or the model stops at its token limit, TT reports the problem instead of silently
237
+ returning to the prompt. A failed summary does not replace the saved one.
209
238
 
210
239
  For educational questions about how or why training works, the agent can read
211
240
  the exact Python implementation shipped with the running TT build. The source
@@ -234,20 +263,63 @@ sealed as `outcome_unknown` for manual inspection. `/reject` never mutates.
234
263
  Pipeline dry-runs also wait for `/approve`. Preparation fingerprints the
235
264
  workspace directory identity, spec, and adjacent config, revalidates them,
236
265
  copies the resolved spec, config, and pipeline into private temporary inputs,
237
- and invokes `tt pipeline run --dry-run` deterministically. Persisted proposals
238
- that request real execution fail before the child command is dispatched. Real
239
- training remains available through the explicit direct `tt pipeline run` command.
266
+ and invokes `tt pipeline run --dry-run` deterministically. A dry-run proposal
267
+ edited to request real execution fails before the child command is dispatched.
268
+ After a dry-run of the same spec bytes completes, the agent can propose a real
269
+ background run with a reason; approval starts it in a detached process and the
270
+ conversation continues. The agent reports progress with read-only tools and can
271
+ cancel a run only through another approval. Each run keeps an audit record
272
+ (reason, requester, choices, resources, outcome and metrics), a hash-chained event
273
+ log and its full log; `TT_MAX_PARALLEL_RUNS` limits concurrent runs. See
274
+ [background runs](docs/local-runtime/background-runs.md). The direct
275
+ `tt pipeline run` and `tt pipeline start` commands remain available.
240
276
  A changed workspace or spec requires a new review.
241
277
 
278
+ The startup **What you can do** panel covers specs/datasets, decision training,
279
+ LLM fine-tuning, training from scratch, and serving even before a spec exists.
280
+ Decision training can use CPU or Apple MPS; the other training paths currently
281
+ require CUDA locally or a configured AWS GPU. A missing NVIDIA GPU does not
282
+ prevent spec creation or dataset preparation. The banner lists ready workflows on
283
+ one line and shows only the status of the rest; `/system` adds reasons and next steps.
284
+
285
+ Guidance distinguishes **Ready**, **Needs setup**, **Limited resources**,
286
+ **Remote GPU**, **Needs verification**, and **Unsupported runtime**. Quick
287
+ startup sampling does not install Python dependencies. `tt hardware` explicitly
288
+ checks the locked adapter and decision runtimes separately, including MPS
289
+ availability; it may install those runtimes on first use. It does not download
290
+ models or certify their fit. Old snapshots without a decision probe show
291
+ "Needs verification" until refreshed.
292
+
293
+ | Platform | Decision training | LLM / foundation training | Packaged LLM serving |
294
+ | --- | --- | --- | --- |
295
+ | Linux x64 / ARM64 | CPU; CUDA when available | NVIDIA CUDA, subject to memory and runtime checks | Linux + NVIDIA CUDA; separate runtime |
296
+ | Apple Silicon macOS | CPU / MPS after runtime checks | Remote AWS GPU | Remote Linux/CUDA host |
297
+ | Native Windows x64 | CPU path; end-to-end training not yet certified | Not certified natively; check a Linux/WSL2 environment or use AWS | Linux/CUDA host |
298
+ | Intel macOS / Windows ARM64 | No compatible wheels in the current lockfiles | Remote AWS GPU | Remote Linux/CUDA host |
299
+
300
+ The native Windows CI job verifies hardware discovery and displayed guidance,
301
+ not model training. WSL is assessed as its own Linux environment. AMD/Intel GPU
302
+ acceleration is not enabled by the packaged CUDA runtime. Decision resource
303
+ warnings use conservative advisory thresholds (8 GiB available working memory,
304
+ 6 GiB free model-cache disk, 4 CPU cores); they are not measured model minima.
305
+ Batch size, sequence length, training mode and other running applications matter.
306
+ CPU evaluation does not imply that `tt serve` can run on CPU. Agent chat still
307
+ needs managed access or your own model provider; local data commands need neither.
308
+
242
309
  Useful shell controls include `/help`, `/status`, `/context`, `/system`,
243
- `/model`, `/login`, `/cd`, `/clear`, and `/exit`.
310
+ `/usage` (managed agent allowance and token usage), `/model`, `/login`, `/cd`, `/clear`, and `/exit`.
244
311
  When the shell opens, the TT logo mark (drawn in the terminal) greets you with the current spec, a
245
312
  live machine panel (GPU utilization, VRAM and temperature from `nvidia-smi`,
246
- CPU, RAM, and free space in the model cache) and whether this machine can
313
+ CPU, RAM, and free space on the model-cache filesystem) and whether this machine can
247
314
  fine-tune the spec's base model, plus a suggested next step. `/system` refreshes
248
315
  that panel and lists every certified base model's verdict. Fit verdicts come
249
316
  from the same certified memory profiles as `tt hardware`; a fresh
250
317
  `tt hardware` snapshot takes precedence over the quick live check.
318
+ On macOS, RAM marked `in use (est.)` excludes estimated reclaimable file cache;
319
+ decision-training warnings use the same available-RAM estimate. This is not a
320
+ memory-pressure measurement or a guarantee that a workload fits. CPU load is a
321
+ one-minute average, separate from the sampled utilization percentage. Disk usage
322
+ describes the filesystem containing the cache, not the size of downloaded models.
251
323
  The shell banner and `/context` show the inference selection (`agent
252
324
  provider/model`) separately from the workflow model. The managed alias identifies
253
325
  inference through the server-selected model. Run `/model` with no arguments to
@@ -545,12 +617,73 @@ tt datasets verify tunedtensor.json # offline checksum check of the cached f
545
617
  tt pipeline run --spec tunedtensor.json # downloads automatically if still missing
546
618
  ```
547
619
 
548
- - Split paths are files inside the repo and must be JSONL. Parquet and CSV are
549
- not supported yet.
620
+ In `tt agent`, ask it to download a dataset or model. It proposes the same
621
+ `tt datasets prefetch` or `tt models prefetch` command and runs it after you
622
+ approve. The source does not have to be in the spec yet: download first, look at
623
+ it, then ask the agent to adopt it, and it proposes a spec edit pinned to the
624
+ commit the download resolved. A download alone needs a training filename, not
625
+ a validation split or column mapping; those are required when configuring training.
626
+ Approval checks the workspace, spec and adjacent legacy runner configuration,
627
+ then runs a private snapshot of the reviewed settings. Later edits cannot redirect
628
+ the running download. After a failure or cancellation, ask for a new download
629
+ proposal to resume from the cache.
630
+
631
+ ### Downloads and the lock file
632
+
633
+ Any Hugging Face dataset files or model can be downloaded without editing a spec:
634
+
635
+ ```bash
636
+ tt datasets prefetch --repo HuggingFaceH4/ultrachat_200k \
637
+ --training data/train_sft-00000-of-00003.parquet --test data/test_sft-00000-of-00001.parquet
638
+ tt models prefetch --repo Qwen/Qwen3-4B-Instruct-2507 # add --revision <sha> to pin
639
+ ```
640
+
641
+ Direct downloads also work before a spec exists or while it is invalid; those
642
+ workspaces use the default cache. An approved agent download reports the commit
643
+ from that command's result for a later spec edit.
644
+
645
+ Files stay in the Hugging Face cache (`HF_HOME`, or `runtime.paths.modelCache`).
646
+ Each download also writes a manifest with the repo, commit, file digests and
647
+ location under `~/.tuned-tensor/assets/`, so downloads are easy to find later:
648
+
649
+ ```bash
650
+ tt assets list # everything downloaded, newest first
651
+ tt assets path org/name # where it is on disk (org/name@<sha> for one revision)
652
+ tt assets verify [org/name] # re-hash the files against their manifests
653
+ ```
654
+
655
+ `tunedtensor.lock.json` beside the spec pins what a project trains on, the way
656
+ `.terraform.lock.hcl` pins providers: the dataset and base-model repo, commit,
657
+ and each file's Hugging Face content digest (`sha256:` for LFS files,
658
+ `git-sha1:` for small git files). `tt datasets prefetch` and `tt models prefetch`
659
+ for the spec write it, and the first real run records any entry it is missing.
660
+ After that, `tt pipeline run`:
661
+
662
+ - uses the locked commit when the spec's dataset does not pin `revision`;
663
+ - re-hashes the cached bytes and stops if the spec names another repo or revision,
664
+ a cached file's digest differs, or a locked model file is missing. If the change is intended, rerun the matching
665
+ `prefetch` command for the spec to update the lock.
666
+
667
+ A first local run with an empty model cache downloads and locks the model before
668
+ training starts. Dry runs never download assets or write the lock.
669
+
670
+ An unpinned dataset stays on its locked commit, including for `tt datasets prefetch`.
671
+ To move it to a newer commit, pin that `revision` in the spec and prefetch again.
672
+
673
+ Commit the lock file with the spec. Runs that load the base model from
674
+ `runtime.paths.baseModel` or on an AWS GPU host check only the dataset.
675
+
676
+ - Split paths are files inside the repo: one `.jsonl` or `.parquet` file per
677
+ split (pick one shard of a sharded split). CSV is not supported yet.
678
+ - Parquet supports Snappy, gzip, zstd, Brotli and LZ4 compression, as well as
679
+ uncompressed files.
550
680
  - Without `columns`, files must already be TT chat JSONL whose system message
551
681
  matches the spec. With `columns`, each record's `input` and `output` fields
552
- become chat rows that use the spec's instruction. Records missing either
553
- field are skipped. Evaluation splits keep the first of any duplicate input,
682
+ become chat rows that use the spec's instruction. Parquet files require
683
+ `columns`. For chat datasets such as `HuggingFaceH4/ultrachat_200k`, use
684
+ `"columns": { "messages": "messages" }`: each conversation's first user turn
685
+ and the assistant reply that follows become one example; later turns are not
686
+ used. Records missing a mapped field are skipped. Evaluation splits keep the first of any duplicate input,
554
687
  and training drops inputs that also appear in an evaluation split. The run
555
688
  report lists every skipped or dropped count.
556
689
  - Without `revision`, TT uses the cached `main` snapshot and records the commit
@@ -567,6 +700,13 @@ tt pipeline run --spec tunedtensor.json # downloads automatically if still missi
567
700
  `--verbose` adds training and evaluation process output, and `--quiet` hides
568
701
  both. Full logs stay in the run directory either way.
569
702
 
703
+ Adapter evaluation batches four prompts by default, reports
704
+ completed examples and ETA, and saves completed batches for recovery. Set
705
+ `evaluation.inference.batchSize` to tune memory use; `evaluation.maxExamples`
706
+ and `sampleSeed` select an explicit smoke sample. Matching interrupted
707
+ baselines automatically continue on retry with the default baseline cache.
708
+ See [evaluation settings and recovery](docs/local-runtime/architecture.md#evaluation).
709
+
570
710
  Every run report has a `provenance` block recording what produced it:
571
711
 
572
712
  - TT, Node and platform versions, and the digest of the locked Python runtime;
@@ -671,6 +811,26 @@ For the full command reference, including long-example policies, eval token
671
811
  budgets, evaluation caps, and local model serving, see the
672
812
  [CLI docs](https://tunedtensor.com/docs/cli).
673
813
 
814
+ ### Split a master dataset
815
+
816
+ Keep converted datasets as unsplit chat JSONL. Downloaded chat JSONL can be
817
+ split directly from its verified cache: ask the agent to inspect the download
818
+ and use its pinned `split_source`, with no manual copy. Ask it to split a named
819
+ file with your ratios and seed, then attach the approved paths to your spec.
820
+ For example: “Split data.jsonl 80/20 for training and validation with seed 123,
821
+ stratify by metadata.category, and save to split-123.”
822
+
823
+ ```sh
824
+ tt datasets inspect data.jsonl
825
+ tt datasets split data.jsonl --output split-123 --train .8 --validation .2 --test 0 --seed 123
826
+ ```
827
+
828
+ The source stays unchanged. Groups containing repeated prompts stay in training
829
+ so held-out prompts remain unique;
830
+ optional `--group-by` and `--stratify-by` support family and label boundaries.
831
+ See [splitting local data](docs/spec-workflow.md#splitting-an-unsplit-dataset)
832
+ for defaults, metadata preservation, and benchmark holdout limitations.
833
+
674
834
  ## Development
675
835
 
676
836
  ```bash