@tuned-tensor/cli 0.13.0-beta.1 → 0.13.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.
@@ -66,7 +66,7 @@ import {
66
66
  withHuggingFaceCacheEnvironment,
67
67
  withOfflineHuggingFaceCacheEnvironment,
68
68
  writeJsonAtomic
69
- } from "./chunk-2VJ3VVZF.js";
69
+ } from "./chunk-YJYCGSHJ.js";
70
70
 
71
71
  // src/local-runtime/index.ts
72
72
  import { readFileSync, realpathSync } from "fs";
@@ -221,6 +221,14 @@ async function runCommand(command, args, options = {}) {
221
221
  function firstLine(value) {
222
222
  return value.trim().split(/\r?\n/)[0] ?? "";
223
223
  }
224
+ function nvidiaSmiSummary(stdout) {
225
+ const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
226
+ const queried = lines.find(
227
+ (line) => !/^(?:mon|tue|wed|thu|fri|sat|sun)\b/i.test(line) && !line.startsWith("+---") && !line.startsWith("|")
228
+ );
229
+ if (queried) return queried;
230
+ return firstLine(stdout) || "nvidia-smi reported a GPU";
231
+ }
224
232
  function commandText(command, args) {
225
233
  return [command, ...args].map((part) => /\s/.test(part) ? JSON.stringify(part) : part).join(" ");
226
234
  }
@@ -374,11 +382,15 @@ async function runDoctor(config, request) {
374
382
  }
375
383
  const device = config.evaluation.inference.device;
376
384
  if (!config.dryRun) {
377
- const nvidiaSmi = await runCommand("nvidia-smi", []);
385
+ const queried = await runCommand("nvidia-smi", [
386
+ "--query-gpu=name,driver_version",
387
+ "--format=csv,noheader"
388
+ ]);
389
+ const nvidiaSmi = queried.code === 0 ? queried : await runCommand("nvidia-smi", []);
378
390
  checks.push({
379
391
  name: "nvidia-smi",
380
392
  ok: nvidiaSmi.code === 0,
381
- message: nvidiaSmi.code === 0 ? firstLine(nvidiaSmi.stdout) : nvidiaSmi.error ?? (firstLine(nvidiaSmi.stderr) || "nvidia-smi not available")
393
+ message: nvidiaSmi.code === 0 ? nvidiaSmiSummary(nvidiaSmi.stdout) : nvidiaSmi.error ?? (firstLine(nvidiaSmi.stderr) || "nvidia-smi not available")
382
394
  });
383
395
  } else {
384
396
  checks.push({
@@ -672,7 +684,7 @@ var TT_LOCAL_VERSION = packageVersion();
672
684
  function getLocalRunnerInfo() {
673
685
  return {
674
686
  name: "tuned-tensor-local",
675
- status: "local-runner-preview",
687
+ status: "local",
676
688
  description: "Local CUDA LoRA fine-tuning with held-out base-versus-tuned evaluation.",
677
689
  version: TT_LOCAL_VERSION
678
690
  };
@@ -1071,6 +1083,17 @@ async function verifyStoredModel(model, config) {
1071
1083
  };
1072
1084
  }
1073
1085
  async function verifyActivationEvidence(model) {
1086
+ const generalBaseline = join3(model.artifact_dir, "general-baseline-eval.json");
1087
+ const generalCandidate = join3(model.artifact_dir, "general-candidate-eval.json");
1088
+ const [hasBaseline, hasCandidate] = await Promise.all([
1089
+ stat(generalBaseline).then((metadata) => metadata.isFile(), () => false),
1090
+ stat(generalCandidate).then((metadata) => metadata.isFile(), () => false)
1091
+ ]);
1092
+ if (!hasBaseline || !hasCandidate) {
1093
+ throw new Error(
1094
+ "This model cannot be activated because the run did not include a general-regression suite. Add evaluation.generalRegression to local-runner.json with a held-out dataset, re-run training, then activate. Until then, serve the adapter with `tt serve local-<run-id>`."
1095
+ );
1096
+ }
1074
1097
  await assertArtifactManifest(join3(model.artifact_dir, "artifact-manifest.json"), {
1075
1098
  requiredPaths: [
1076
1099
  "run-report.json",
@@ -1226,8 +1249,6 @@ async function serveStoredModelFromCli(args) {
1226
1249
  return;
1227
1250
  }
1228
1251
  process.stderr.write(`[tt-local] verified ${verified.integrity.checked} artifact file(s)
1229
- `);
1230
- process.stderr.write(`[tt-local] model API: ${launch.url}
1231
1252
  `);
1232
1253
  await serveLocalModel(launch);
1233
1254
  }
@@ -1285,8 +1306,6 @@ async function serveBaseModelFromCli(args) {
1285
1306
  });
1286
1307
  return;
1287
1308
  }
1288
- process.stderr.write(`[tt-local] protected base model API: ${launch.url}
1289
- `);
1290
1309
  await serveLocalModel(launch);
1291
1310
  }
1292
1311
  async function serveModelTargetFromCli(args) {
@@ -1296,7 +1315,11 @@ async function serveModelTargetFromCli(args) {
1296
1315
  if (args.target === "active") {
1297
1316
  const store = createLocalStore(args.config.storeRoot);
1298
1317
  const active = await getActiveModel(store);
1299
- if (!active.model) return serveBaseModelFromCli(args);
1318
+ if (!active.model) {
1319
+ throw new Error(
1320
+ "No adapter is active. `tt serve active` would serve the protected base model. Activate a verified adapter first with `tt models activate <model-id>`, or pass `tt serve base` explicitly."
1321
+ );
1322
+ }
1300
1323
  return serveStoredModelFromCli({
1301
1324
  argv: args.argv,
1302
1325
  modelId: active.model.id,
@@ -1515,7 +1538,13 @@ async function main(argv) {
1515
1538
  if (subcommand === "get") {
1516
1539
  const id = cli.positionals[0];
1517
1540
  if (!id) throw new Error("models get requires <model-id>");
1518
- return printJson(await store.getModel(id));
1541
+ const model = await store.getModel(id);
1542
+ const verified = await verifyStoredModel(model, config);
1543
+ return printJson({
1544
+ ok: true,
1545
+ model,
1546
+ ...verified
1547
+ });
1519
1548
  }
1520
1549
  if (subcommand === "verify") {
1521
1550
  const id = cli.positionals[0];