@tuned-tensor/cli 0.15.1 → 0.17.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.
@@ -127,17 +127,28 @@ hide a valid artifact. Serving verifies the manifest again.
127
127
 
128
128
  ## Configuration
129
129
 
130
- The runner config controls only:
130
+ The runner config controls:
131
131
 
132
132
  - state, artifact, and Hugging Face cache paths;
133
+ - optional AWS instance lookup, SSH access, and a remote process deadline;
133
134
  - CUDA or CPU evaluation, with local serving through the CUDA vLLM runtime;
134
135
  - deterministic generation and scoring limits.
135
136
 
136
- The training project, Python entrypoints, working directory, and child
137
- environment are internal and fixed. Every stage uses the locked `uv` project
138
- included in the npm package. The mutable virtual environment lives in
139
- `~/.tuned-tensor/cache`, keyed by the project and lockfile content, so a
140
- read-only global npm install remains runnable.
137
+ The training project, Python entrypoints, working directory, and forwarded
138
+ runtime settings are internal and fixed. Every stage uses the locked `uv`
139
+ project included in the npm package. Locally, the mutable virtual environment
140
+ lives in `~/.tuned-tensor/cache`, keyed by the project and lockfile content, so
141
+ a read-only global npm install remains runnable.
142
+
143
+ With [`gpu` configured](aws-gpu.md), the same orchestrator dispatches adapter
144
+ training and CUDA inference, or foundation stages after tokenization, over SSH
145
+ to an existing EC2 instance. It stages the bundled Python source, lockfile and
146
+ declared inputs in a private remote directory, creates the runtime environment
147
+ there, and retrieves outputs before cleanup. Dataset compilation, adapter
148
+ scoring/comparison, artifact validation and run state remain local. Foundation
149
+ tokenization also stays local. Serving and `tt hardware` inspect/use the local
150
+ host. AWS credentials authorize instance lookup locally; they are not forwarded
151
+ to GPU processes. TT does not provision or manage instance capacity.
141
152
 
142
153
  Schemas are strict. Misspelled or obsolete fields fail validation instead of
143
154
  silently reverting to defaults. Training itself is CUDA-only and fails fast
@@ -0,0 +1,248 @@
1
+ # Use your AWS GPU with the local pipeline
2
+
3
+ TT runs one pipeline on your laptop. Add `gpu` to `local-runner.json` to send
4
+ adapter training and CUDA evaluation, or foundation pretraining, fine-tuning,
5
+ RL and evaluation, to an existing EC2 instance in your account. Foundation
6
+ tokenization, dataset preparation, adapter scoring/comparisons, run history,
7
+ and artifact validation stay local. Results return to the usual local
8
+ directories. The laptop does not need an NVIDIA GPU.
9
+
10
+ ## 1. Install TT and create a project
11
+
12
+ Use CLI 0.16.0 or newer with Node.js 22.19+ on Linux or macOS:
13
+
14
+ ```bash
15
+ npm install -g --ignore-scripts @tuned-tensor/cli
16
+ tt --version
17
+ mkdir my-aws-training && cd my-aws-training
18
+ tt init --name "My AWS Adapter" --model Qwen/Qwen3.5-2B
19
+ ```
20
+
21
+ Edit the generated `tunedtensor.json`: replace the placeholder system prompt and both placeholder examples with
22
+ your desired instructions and real input/output pairs. For a small functional
23
+ trial, use the [four-example smoke spec](../../examples/local-runtime/smoke-spec.json)
24
+ instead. It checks the workflow, not model quality. An existing project can keep
25
+ its spec and pipeline unchanged.
26
+
27
+ ## 2. Prepare your AWS instance
28
+
29
+ You need two separate kinds of access: an **AWS profile** to find the instance,
30
+ and an **SSH key or agent** to execute commands on it. A TT login is unnecessary.
31
+ If you do not already have an instance, launch one in your AWS account or ask
32
+ your administrator to provide one with the prerequisites below.
33
+
34
+ Our CLI 0.16.0 smoke test used a `g5.xlarge` (A10G), an AWS Deep Learning Base
35
+ GPU AMI with Ubuntu 24.04, and a 120 GiB root disk in `eu-west-1`. This is a
36
+ tested small-workload configuration, not a sizing guarantee for other models.
37
+ Use a driver compatible with the bundled CUDA runtime; `tt doctor` checks it.
38
+
39
+ Before launching, check the EC2 GPU quota in your chosen region. For the tested
40
+ G-family On-Demand instance, the quota is **Running On-Demand G and VT instances**
41
+ (`L-DB2E81BA`), measured in vCPUs; one `g5.xlarge` needs 4 available vCPUs.
42
+ If it is too low, follow [AWS's quota increase procedure](https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html).
43
+ Approval does not guarantee instance availability. TT does not request capacity
44
+ or choose a different region for you.
45
+
46
+ During launch, select your [EC2 SSH key pair](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html),
47
+ allow inbound TCP 22 from your laptop's IP (or use your private network), and
48
+ record the instance ID, region, SSH username and IP. Follow
49
+ [AWS's SSH connection prerequisites](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-to-linux-instance.html).
50
+ Instance creation and quota management need separate AWS permissions; TT itself
51
+ only needs `ec2:DescribeInstances` for lookup.
52
+
53
+ ## 3. Configure the connection
54
+
55
+ Save this as `local-runner.json` beside `tunedtensor.json`,
56
+ replacing the example values with your own. You can also copy
57
+ [`examples/local-runtime/aws-runner.json`](../../examples/local-runtime/aws-runner.json).
58
+ All runner paths refer to the laptop; TT translates the paths needed remotely.
59
+
60
+ ```json
61
+ {
62
+ "gpu": {
63
+ "provider": "aws",
64
+ "profile": "research",
65
+ "region": "eu-west-1",
66
+ "instanceId": "i-0123456789abcdef0",
67
+ "user": "ubuntu",
68
+ "identityFile": "~/.ssh/research-gpu.pem",
69
+ "maxSeconds": 86400
70
+ }
71
+ }
72
+ ```
73
+
74
+ The laptop needs AWS CLI v2, OpenSSH, rsync 3.2+, and uv. On macOS, install
75
+ a current rsync (for example with Homebrew); the system version is too old.
76
+ Each machine must find its required programs through `PATH`; on the instance,
77
+ this includes noninteractive SSH sessions. The instance needs Linux, a compatible NVIDIA
78
+ GPU/driver, uv, rsync 3.2+, bash, setsid, and GNU timeout. TT
79
+ copies the bundled Python source and lockfile and runs that exact runtime
80
+ with `uv run --frozen`; there is no separate training image or Step Functions
81
+ pipeline. Internet access on the instance is needed to install the locked
82
+ runtime. No TT token is needed for training.
83
+
84
+ `profile` and `region` are optional. AWS CLI uses its normal credential chain,
85
+ including environment credentials, configured profiles and SSO. For SSO, log
86
+ in first with `aws sso login --profile research`. The selected identity needs
87
+ `ec2:DescribeInstances`. TT resolves the instance using
88
+ [AWS DescribeInstances](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html).
89
+ An AWS profile authorizes the lookup; SSH access to the machine is also required.
90
+ The selected instance must already be running in the selected region and have
91
+ enough GPU memory and free disk for the model, runtime, inputs and outputs.
92
+
93
+ Verify the instance's SSH host key for the selected IP address and connect
94
+ once yourself before using TT. TT requires a known host key and noninteractive
95
+ SSH authentication. Omit
96
+ `identityFile` to use your SSH agent or SSH configuration. Relative identity
97
+ file paths resolve beside the runner config; `~` expands locally. Set
98
+ `privateIp: true` when connected to the instance's VPC through a VPN or other
99
+ private network. The default uses its public IPv4 address. Security groups and
100
+ network routes must allow the laptop to reach that address over SSH.
101
+ TT addresses the instance by IP, so any `Host` rules in your SSH configuration
102
+ must match that IP. Remote Python commands run through `bash -lc`, which loads
103
+ the login profile so a normal uv installation can be found.
104
+
105
+ After configuring your AWS profile (for SSO, use `aws configure sso` once),
106
+ check access from the same terminal that will run TT:
107
+
108
+ ```bash
109
+ # SSO profiles only; skip this line for other credential methods.
110
+ aws sso login --profile research
111
+ aws sts get-caller-identity --profile research
112
+ aws ec2 describe-instances --profile research --region eu-west-1 \
113
+ --instance-ids i-0123456789abcdef0 \
114
+ --query 'Reservations[0].Instances[0].[State.Name,PublicIpAddress]' --output text
115
+ ```
116
+
117
+ Use the returned IP below. First verify its host fingerprint through your AWS
118
+ console or administrator and connect interactively to record the verified key.
119
+ Then confirm that unattended SSH works:
120
+
121
+ ```bash
122
+ chmod 400 ~/.ssh/research-gpu.pem
123
+ ssh -o BatchMode=yes -o StrictHostKeyChecking=yes \
124
+ -i ~/.ssh/research-gpu.pem ubuntu@YOUR_INSTANCE_IP \
125
+ 'bash -lc "command -v uv rsync setsid timeout; nvidia-smi"'
126
+ ```
127
+
128
+ If `uv` is missing, install it on that machine using the
129
+ [uv installation instructions](https://docs.astral.sh/uv/getting-started/installation/)
130
+ and make it available in the login shell. Install the other listed prerequisites
131
+ with that machine's package manager. Run the SSH check again before training.
132
+
133
+ ## 4. Preview and run
134
+
135
+ Run these commands on your laptop in the project directory. Adapter workflow:
136
+
137
+ ```bash
138
+ # Fetch the base model locally first.
139
+ tt validate tunedtensor.json
140
+ tt models prefetch tunedtensor.json --config local-runner.json
141
+ tt doctor tunedtensor.json --config local-runner.json
142
+ tt pipeline run --spec tunedtensor.json --config local-runner.json --dry-run
143
+ tt pipeline run --spec tunedtensor.json --config local-runner.json
144
+ ```
145
+
146
+ For a foundation spec, no base-model prefetch is needed. Start a new run with:
147
+
148
+ ```bash
149
+ tt validate tunedtensor.json
150
+ tt doctor tunedtensor.json --config local-runner.json
151
+ tt pipeline run --spec tunedtensor.json --config local-runner.json \
152
+ --dry-run
153
+ tt pipeline run --spec tunedtensor.json --config local-runner.json
154
+ ```
155
+
156
+ Choose the command block for your spec's engine. `tt doctor` connects to the
157
+ instance and prepares/probes its locked Python/CUDA runtime, which may take
158
+ time on first use. It does not start training or reserve GPU capacity.
159
+ `tt hardware` reports the laptop's hardware; it does not inspect the AWS
160
+ instance. `tt pipeline run` discovers `local-runner.json` beside the selected
161
+ spec when `--config` is omitted.
162
+
163
+ Keep pipeline step targets set to `local`: the target describes the
164
+ orchestrator, and `gpu` selects where its GPU processes execute. CPU adapter
165
+ evaluation (`evaluation.inference.device: "cpu"`) stays on the laptop.
166
+ Remove `gpu` to execute everything locally. `--dry-run` or `dryRun: true`
167
+ does not connect to AWS or copy files.
168
+
169
+ ## 5. Inspect results and finish
170
+
171
+ Wait for a successful completion message. Adapter runs return a run ID and a
172
+ local model ID; use the actual IDs from the output:
173
+
174
+ ```bash
175
+ tt runs list --config local-runner.json
176
+ tt runs report RUN_ID --config local-runner.json
177
+ tt models list --config local-runner.json
178
+ tt models verify MODEL_ID --config local-runner.json
179
+ ```
180
+
181
+ For foundation runs, inspect `report.json` in the run directory printed by the
182
+ command. To resume it, pass `--resume /absolute/path/to/foundation-run` to the
183
+ same `tt pipeline run` command. Keep the laptop awake and connected until the
184
+ command finishes and outputs have returned. Review the report before another run.
185
+
186
+ Stop or terminate your instance in AWS when finished, according to your own
187
+ retention needs. TT does not do this for you, even after cancellation or timeout.
188
+
189
+ ## Transfers and recovery
190
+
191
+ TT copies only each process's declared data, model snapshot, and runtime files,
192
+ not the workspace or laptop credentials. Adapter runs use an immutable local
193
+ model snapshot; the Hugging Face credential/cache root is never uploaded.
194
+ GPU processes inherit the remote machine's environment plus a small set of
195
+ explicit runtime settings. Gated-model authentication happens during local
196
+ prefetch. Logs stream to the laptop; models and foundation checkpoints are
197
+ downloaded when the process ends, before temporary remote files are removed.
198
+ Staging paths are stable for checkpoint resume and reserved exclusively; an
199
+ existing directory blocks a new process until its previous work or artifacts
200
+ are recovered. Inputs and runtime files are staged for each process, so large
201
+ models incur transfer time and require space on both
202
+ machines, including the instance's `/tmp`. Serving remains local in this version.
203
+
204
+ Foundation `checkpoint_backup_dir` is also a local path that TT stages remotely.
205
+ Keep it outside the foundation run directory; overlapping input, output,
206
+ recovery or backup paths are rejected before transfer.
207
+ During pretraining, both rolling checkpoints and this backup are written under
208
+ the instance's staging directory. They return to the laptop only after the
209
+ process ends or is cancelled; there is no continuous backup to the laptop or
210
+ to a separate remote disk. Protect and recover that staging directory if the
211
+ connection fails. See [long foundation runs](foundation-long-runs.md) for the
212
+ checkpoint contents and resume contract.
213
+
214
+ Cancellation signals the remote process group and retrieves available
215
+ outputs while SSH remains reachable. If SSH or artifact retrieval fails, the
216
+ error includes the remote staging directory for recovery; keep it until you have recovered
217
+ your files. A remote timeout (24 hours by default, configurable from 60 seconds
218
+ to 7 days per process) limits work after a lost connection or laptop failure.
219
+ Adapter evaluation also retains `evaluation.timeoutMs` (30 minutes by default),
220
+ and individual transfer/setup commands have a 30-minute timeout. Increasing
221
+ `gpu.maxSeconds` does not extend those limits.
222
+ The pipeline needs the laptop to stay running; it is not a detached scheduler.
223
+ Foundation pretraining can resume from returned checkpoints using its existing
224
+ `--resume` command. Use the same laptop run directory and unchanged spec/data
225
+ so checkpoint identities still match. Adapter training keeps its existing
226
+ restart behavior.
227
+
228
+ You provide capacity and pay AWS directly. TT does not create, start, stop,
229
+ terminate or resize instances, request quotas, choose fallback instances or
230
+ fall back to another account. An AWS profile alone cannot create capacity.
231
+ The instance remains running after the job; its lifecycle is yours to manage.
232
+
233
+ Hosted training submission (`tt cloud runs start` and `estimate`) is retired.
234
+ Existing cloud reports and cancellation of older hosted jobs remain available.
235
+ This CLI change does not delete deployed AWS infrastructure or historical data.
236
+
237
+ ## Troubleshooting a first run
238
+
239
+ | Symptom | What to check |
240
+ | --- | --- |
241
+ | AWS credentials expired or access denied | Renew your SSO login, check the selected profile/account, and ask for `ec2:DescribeInstances` permission. |
242
+ | Instance not found or not running | Confirm the instance ID and region, and start the instance through AWS. |
243
+ | GPU quota or capacity error during launch | Check the regional quota and AWS capacity; a TT token or credit top-up will not fix it. |
244
+ | SSH timeout or permission denied | Check IP routing, security group TCP 22 access, SSH username, key and agent using the manual SSH command above. |
245
+ | Host key verification failed | Verify the host fingerprint through AWS or your administrator; do not disable strict host checking. |
246
+ | `uv` missing or CUDA probe fails | Check the remote login-shell PATH and GPU driver; rerun `tt doctor` after correcting the host. |
247
+ | Long pause before the GPU process starts | Model inputs are uploaded for every process. Check network speed and free space on both machines, especially remote `/tmp`. |
248
+ | Download fails or staging directory already exists | Preserve the remote directory shown in the error and recover its outputs before retrying. Do not remove the only checkpoint copy. |
@@ -4,6 +4,10 @@ The foundation engine can run recoverable, single-GPU pretraining from `.txt`
4
4
  files or JSONL shards whose rows contain a string `text` field. Keep training
5
5
  and validation data in different files or directories.
6
6
 
7
+ The commands below also support an [AWS GPU](aws-gpu.md) configured in the
8
+ adjacent `local-runner.json`. The CLI and tokenizer still run locally; the
9
+ local machine must stay awake and connected throughout the pipeline.
10
+
7
11
  ## Spec
8
12
 
9
13
  The long-run fields live under `foundation` in `tunedtensor.json`:
@@ -69,11 +73,22 @@ SIGINT or SIGTERM requests a step-boundary checkpoint. The CLI allows up to two
69
73
  minutes for that checkpoint before forcibly stopping the process. SIGKILL or a
70
74
  power loss falls back to the most recent periodic checkpoint.
71
75
 
76
+ With AWS execution, checkpoints remain in remote staging during pretraining
77
+ and are downloaded when the process ends or cancellation succeeds. The
78
+ configured `checkpoint_backup_dir` is mapped into that same remote staging
79
+ tree, then copied back to its local destination; it is not a live backup to
80
+ another disk or to the laptop. Keep the backup directory outside the run
81
+ directory; AWS execution rejects overlapping paths. An interrupted connection
82
+ may need manual recovery from the remote path printed in the error before
83
+ `--resume` can run.
84
+ Set `gpu.maxSeconds` to cover the intended pretrain stage (default 24 hours,
85
+ maximum 7 days); reaching the deadline ends that process.
86
+
72
87
  ## User service
73
88
 
74
- For unattended operation, run the resumable command under a user systemd
75
- service. Replace every path with an absolute path and use the installed `tt`
76
- path reported by `command -v tt`:
89
+ For unattended operation on a Linux machine running the CLI, run the resumable
90
+ command under a user systemd service. Replace every path with an absolute path
91
+ and use the installed `tt` path reported by `command -v tt`:
77
92
 
78
93
  ```ini
79
94
  [Unit]
@@ -102,7 +117,8 @@ journalctl --user -fu tt-foundation.service
102
117
  ```
103
118
 
104
119
  Enable user lingering if the job must survive logout. Use a UPS for power-loss
105
- protection, and put `checkpoint_backup_dir` on a different physical disk or
106
- remote mounted filesystem. Before a multi-day run, complete a full-load soak,
120
+ protection. With a local GPU, put `checkpoint_backup_dir` on a different
121
+ physical disk or remote mounted filesystem. AWS staging does not provide that
122
+ separate-disk guarantee. Before a multi-day run, complete a full-load soak,
107
123
  stop the service during pretraining, and verify the journal reports a resumed
108
124
  checkpoint after restart.
@@ -13,11 +13,21 @@ not mutate the training runtime.
13
13
  serving is not supported by this runtime; CLI/package commands still work
14
14
  there. Unsupported hardware or model/adapter combinations fail rather than
15
15
  silently falling back to the old server.
16
+ - `gpu` in `local-runner.json` applies to training and evaluation. It does not
17
+ move `tt serve` to AWS; returned artifacts still need a Linux/CUDA machine
18
+ running the serving command.
16
19
  - Install `uv` and prefetch the certified model with `tt models prefetch`.
17
20
  First launch installs the locked serving dependencies and may compile kernels;
18
21
  it needs substantially more time and disk than a warm request. CUDA JIT may
19
22
  require a working CUDA toolkit/C++ toolchain. Model loading remains offline.
20
- - Foundation checkpoints and image inputs are not supported by this path.
23
+ - Foundation model directories are supported through a temporary GPT-2 export;
24
+ pass `tt serve foundation --checkpoint <model-dir> --tokenizer <tokenizer.json>`.
25
+ The tokenizer must be the one used during training. Export checks vocabulary
26
+ size and required special tokens, not tokenizer identity: a different tokenizer
27
+ with the same vocabulary size can pass these checks and produce incorrect text.
28
+ Keep each model paired with its original training tokenizer. Context defaults to
29
+ the checkpoint limit. Text completions and chat are supported; foundation tool-call
30
+ parsing and image inputs are not supported.
21
31
  - Qwen3.5-2B base and a one-step, rank-16 `all-linear` TT-shaped adapter have been
22
32
  exercised on GB10. The registry's Nemotron and Muse Glimmer architectures have
23
33
  upstream support, but their exact adapters/hardware combinations are **not