@tuned-tensor/cli 0.16.0 → 0.18.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 +52 -30
- package/dist/{chunk-6RLNBTM6.js → chunk-U5HNS367.js} +371 -40
- package/dist/chunk-U5HNS367.js.map +1 -0
- package/dist/index.js +1243 -842
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.js +30 -39
- package/dist/local-runtime.js.map +1 -1
- package/docs/local-runtime/aws-gpu.md +144 -26
- package/docs/local-runtime/serving.md +2 -2
- package/docs/local-runtime/spark.md +12 -17
- package/docs/spec-architecture.html +573 -0
- package/docs/spec-workflow.md +131 -0
- package/examples/single-spec/adapter/tunedtensor.json +49 -0
- package/examples/single-spec/foundation/tunedtensor.json +31 -0
- package/package.json +6 -3
- package/training/adapter/src/serve.py +6 -0
- package/dist/chunk-6RLNBTM6.js.map +0 -1
package/dist/local-runtime.js
CHANGED
|
@@ -58,11 +58,14 @@ import {
|
|
|
58
58
|
normalizeChatJsonlForRelocation,
|
|
59
59
|
parseLocalRunInput,
|
|
60
60
|
parseLocalRunnerConfig,
|
|
61
|
+
pipelineForRunInput,
|
|
61
62
|
prefetchBaseModel,
|
|
63
|
+
projectRuntimeSchema,
|
|
62
64
|
pythonEnvironmentPath,
|
|
63
65
|
reportInBackground,
|
|
64
66
|
resolveLocalRunInputPaths,
|
|
65
67
|
resolveModelLoader,
|
|
68
|
+
resolveProjectConfig,
|
|
66
69
|
resolveRequestedBaseModelRevision,
|
|
67
70
|
resolveTrainingModel,
|
|
68
71
|
runGpuProcess,
|
|
@@ -71,9 +74,11 @@ import {
|
|
|
71
74
|
runReportSchema,
|
|
72
75
|
runRequestFromLocalSpec,
|
|
73
76
|
sanitizeLogLine,
|
|
77
|
+
specHash,
|
|
74
78
|
specSnapshotSchema,
|
|
75
79
|
tokenF1,
|
|
76
80
|
trainingReportSchema,
|
|
81
|
+
validateBehaviorSpec,
|
|
77
82
|
validateLocalFineTuneInput,
|
|
78
83
|
validateLocalPipeline,
|
|
79
84
|
verifyLocalBaseModel,
|
|
@@ -83,7 +88,7 @@ import {
|
|
|
83
88
|
withHuggingFaceCacheEnvironment,
|
|
84
89
|
withOfflineHuggingFaceCacheEnvironment,
|
|
85
90
|
writePrivateJsonAtomic
|
|
86
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-U5HNS367.js";
|
|
87
92
|
|
|
88
93
|
// src/local-runtime/index.ts
|
|
89
94
|
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
@@ -928,12 +933,11 @@ Global options:
|
|
|
928
933
|
-h, --help Show help
|
|
929
934
|
-V, --version Show the installed version
|
|
930
935
|
|
|
931
|
-
|
|
932
|
-
.tuned-tensor/artifacts
|
|
933
|
-
|
|
934
|
-
TUNED_TENSOR_HOME is set.`);
|
|
936
|
+
tunedtensor.json owns behavior, evaluation, runtime overrides and optional pipeline.
|
|
937
|
+
Project artifacts and state default to .tuned-tensor/artifacts and .tuned-tensor/store.
|
|
938
|
+
TT_LOCAL_HOME overrides the default store. --config is a legacy migration option.`);
|
|
935
939
|
}
|
|
936
|
-
var CONFIG_OPTION = { name: "--config", value: "path", description: "
|
|
940
|
+
var CONFIG_OPTION = { name: "--config", value: "path", description: "Legacy runner config (prefer runtime/evaluation in tunedtensor.json)" };
|
|
937
941
|
var VERBOSE_OPTION = { name: "--verbose", description: "Stream subprocess output" };
|
|
938
942
|
var QUIET_OPTION = { name: "--quiet", description: "Suppress progress output on stderr" };
|
|
939
943
|
var MODEL_SERVE_OPTIONS = [
|
|
@@ -971,8 +975,8 @@ var COMMAND_DEFINITIONS = {
|
|
|
971
975
|
{ name: "--engine", value: "engine", description: "adapter (default) or foundation" },
|
|
972
976
|
{ name: "--model", value: "model", description: "Base model ID" },
|
|
973
977
|
{ name: "--output", value: "path", description: "Output spec path" },
|
|
974
|
-
{ name: "--profile", value: "profile", description: "
|
|
975
|
-
{ name: "--config", value: "path", description: "
|
|
978
|
+
{ name: "--profile", value: "profile", description: "Compatibility host profile (spark); creates only tunedtensor.json" },
|
|
979
|
+
{ name: "--config", value: "path", description: "Deprecated; put runtime/evaluation in tunedtensor.json" },
|
|
976
980
|
{ name: "--force", description: "Overwrite an existing output file" }
|
|
977
981
|
],
|
|
978
982
|
maxPositionals: 0
|
|
@@ -1214,19 +1218,10 @@ function readNumberOption(argv, name) {
|
|
|
1214
1218
|
const value = readOption(argv, name);
|
|
1215
1219
|
return value ? Number(value) : void 0;
|
|
1216
1220
|
}
|
|
1217
|
-
async function
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const metadata = await stat(candidate).catch(() => null);
|
|
1222
|
-
return metadata?.isFile() ? candidate : void 0;
|
|
1223
|
-
}
|
|
1224
|
-
async function configSelectionFromArgv(argv, adjacentTo) {
|
|
1225
|
-
const path = await selectedConfigPath(argv, adjacentTo);
|
|
1226
|
-
return {
|
|
1227
|
-
config: await loadLocalRunnerConfig(path),
|
|
1228
|
-
...path ? { path } : {}
|
|
1229
|
-
};
|
|
1221
|
+
async function configSelectionFromArgv(argv, adjacentTo, input) {
|
|
1222
|
+
const specPath = adjacentTo ?? readOption(argv, "--spec") ?? resolve3(cwd(), DEFAULT_LOCAL_SPEC_PATH);
|
|
1223
|
+
const resolved = await resolveProjectConfig(specPath, readOption(argv, "--config"), (message) => console.error(message), input);
|
|
1224
|
+
return { config: resolved.config, ...resolved.legacyConfigPath ? { path: resolved.legacyConfigPath } : {} };
|
|
1230
1225
|
}
|
|
1231
1226
|
async function configFromArgv(argv, adjacentTo) {
|
|
1232
1227
|
return (await configSelectionFromArgv(argv, adjacentTo)).config;
|
|
@@ -1325,7 +1320,7 @@ async function verifyActivationEvidence(model) {
|
|
|
1325
1320
|
]);
|
|
1326
1321
|
if (!hasBaseline || !hasCandidate) {
|
|
1327
1322
|
throw new Error(
|
|
1328
|
-
"This model cannot be activated because the run did not include a general-regression suite. Add evaluation.generalRegression to
|
|
1323
|
+
"This model cannot be activated because the run did not include a general-regression suite. Add evaluation.generalRegression to tunedtensor.json with a held-out dataset, re-run training, then activate. Until then, serve the adapter with `tt serve local-<run-id>`."
|
|
1329
1324
|
);
|
|
1330
1325
|
}
|
|
1331
1326
|
await assertArtifactManifest(join5(model.artifact_dir, "artifact-manifest.json"), {
|
|
@@ -1742,6 +1737,7 @@ async function main(argv) {
|
|
|
1742
1737
|
if (engine === "foundation" && readOption(argv, "--model")) {
|
|
1743
1738
|
throw new Error("Foundation specs do not take --model; they train a tokenizer and GPT from scratch.");
|
|
1744
1739
|
}
|
|
1740
|
+
if (readOption(argv, "--config")) throw new Error("tt init uses one tunedtensor.json; put overrides in runtime/evaluation instead of --config.");
|
|
1745
1741
|
const spec = await initLocalSpecFile({
|
|
1746
1742
|
outputPath,
|
|
1747
1743
|
name: readOption(argv, "--name") ?? (engine === "foundation" ? "Foundation chat model" : "Local Tuned Tensor Spec"),
|
|
@@ -1749,16 +1745,7 @@ async function main(argv) {
|
|
|
1749
1745
|
baseModel: engine === "foundation" ? void 0 : readOption(argv, "--model") ?? "Qwen/Qwen3.5-2B",
|
|
1750
1746
|
force: hasFlag(argv, "--force")
|
|
1751
1747
|
});
|
|
1752
|
-
const configPath =
|
|
1753
|
-
if (profile) {
|
|
1754
|
-
await initLocalRunnerConfigFile({
|
|
1755
|
-
outputPath: configPath,
|
|
1756
|
-
profile,
|
|
1757
|
-
force: hasFlag(argv, "--force")
|
|
1758
|
-
});
|
|
1759
|
-
} else if (configPath) {
|
|
1760
|
-
await loadLocalRunnerConfig(configPath);
|
|
1761
|
-
}
|
|
1748
|
+
const configPath = void 0;
|
|
1762
1749
|
printJson({
|
|
1763
1750
|
ok: true,
|
|
1764
1751
|
path: outputPath,
|
|
@@ -1810,13 +1797,13 @@ async function main(argv) {
|
|
|
1810
1797
|
}
|
|
1811
1798
|
if (command === "run") {
|
|
1812
1799
|
const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
|
|
1813
|
-
const
|
|
1800
|
+
const input = await loadCliBehaviorSpec(inputPath);
|
|
1801
|
+
const configSelection = await configSelectionFromArgv(argv, inputPath, input);
|
|
1814
1802
|
const configInput = configSelection.config;
|
|
1815
1803
|
const config = localRunnerConfigSchema.parse({
|
|
1816
1804
|
...configInput,
|
|
1817
1805
|
dryRun: hasFlag(argv, "--dry-run") ? true : configInput.dryRun
|
|
1818
1806
|
});
|
|
1819
|
-
const input = await loadCliBehaviorSpec(inputPath);
|
|
1820
1807
|
assertLocalRunInputReady(input.request);
|
|
1821
1808
|
const validated = await validateLocalFineTuneInput({
|
|
1822
1809
|
request: input.request,
|
|
@@ -1844,11 +1831,12 @@ async function main(argv) {
|
|
|
1844
1831
|
}
|
|
1845
1832
|
});
|
|
1846
1833
|
}
|
|
1847
|
-
|
|
1848
|
-
request,
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
}
|
|
1834
|
+
if (input.spec.pipeline) {
|
|
1835
|
+
const result2 = await runLocalPipeline({ request, config, reporter, pipeline: pipelineForRunInput(input), projectSpec: input.spec });
|
|
1836
|
+
printJson(result2);
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
const result = await runLocalFineTune({ request, config, reporter });
|
|
1852
1840
|
printJson({
|
|
1853
1841
|
status: result.report.status,
|
|
1854
1842
|
run_id: result.report.run_id,
|
|
@@ -2063,6 +2051,7 @@ export {
|
|
|
2063
2051
|
parseLocalRunInput,
|
|
2064
2052
|
parseLocalRunnerConfig,
|
|
2065
2053
|
prefetchBaseModel,
|
|
2054
|
+
projectRuntimeSchema,
|
|
2066
2055
|
reportInBackground,
|
|
2067
2056
|
resolveLocalRunInputPaths,
|
|
2068
2057
|
rollbackActiveModel,
|
|
@@ -2072,8 +2061,10 @@ export {
|
|
|
2072
2061
|
runRequestFromLocalSpec,
|
|
2073
2062
|
sanitizeLogLine,
|
|
2074
2063
|
serveLocalModel,
|
|
2064
|
+
specHash,
|
|
2075
2065
|
specSnapshotSchema,
|
|
2076
2066
|
trainingReportSchema,
|
|
2067
|
+
validateBehaviorSpec,
|
|
2077
2068
|
validateLocalFineTuneInput,
|
|
2078
2069
|
validateLocalPipeline,
|
|
2079
2070
|
verifyLocalBaseModel,
|