@tuned-tensor/cli 0.17.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 +33 -28
- package/dist/{chunk-KRKISPHG.js → chunk-U5HNS367.js} +319 -40
- package/dist/chunk-U5HNS367.js.map +1 -0
- package/dist/index.js +290 -341
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.js +26 -39
- package/dist/local-runtime.js.map +1 -1
- package/docs/local-runtime/aws-gpu.md +28 -27
- package/docs/local-runtime/serving.md +2 -2
- package/docs/local-runtime/spark.md +12 -17
- package/docs/spec-architecture.html +18 -18
- package/docs/spec-workflow.md +27 -6
- package/examples/single-spec/adapter/tunedtensor.json +49 -0
- package/examples/single-spec/foundation/tunedtensor.json +31 -0
- package/package.json +4 -3
- package/training/adapter/src/serve.py +6 -0
- package/dist/chunk-KRKISPHG.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,
|
|
@@ -85,7 +88,7 @@ import {
|
|
|
85
88
|
withHuggingFaceCacheEnvironment,
|
|
86
89
|
withOfflineHuggingFaceCacheEnvironment,
|
|
87
90
|
writePrivateJsonAtomic
|
|
88
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-U5HNS367.js";
|
|
89
92
|
|
|
90
93
|
// src/local-runtime/index.ts
|
|
91
94
|
import { readFileSync as readFileSync3, realpathSync } from "fs";
|
|
@@ -930,12 +933,11 @@ Global options:
|
|
|
930
933
|
-h, --help Show help
|
|
931
934
|
-V, --version Show the installed version
|
|
932
935
|
|
|
933
|
-
|
|
934
|
-
.tuned-tensor/artifacts
|
|
935
|
-
|
|
936
|
-
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.`);
|
|
937
939
|
}
|
|
938
|
-
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)" };
|
|
939
941
|
var VERBOSE_OPTION = { name: "--verbose", description: "Stream subprocess output" };
|
|
940
942
|
var QUIET_OPTION = { name: "--quiet", description: "Suppress progress output on stderr" };
|
|
941
943
|
var MODEL_SERVE_OPTIONS = [
|
|
@@ -973,8 +975,8 @@ var COMMAND_DEFINITIONS = {
|
|
|
973
975
|
{ name: "--engine", value: "engine", description: "adapter (default) or foundation" },
|
|
974
976
|
{ name: "--model", value: "model", description: "Base model ID" },
|
|
975
977
|
{ name: "--output", value: "path", description: "Output spec path" },
|
|
976
|
-
{ name: "--profile", value: "profile", description: "
|
|
977
|
-
{ 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" },
|
|
978
980
|
{ name: "--force", description: "Overwrite an existing output file" }
|
|
979
981
|
],
|
|
980
982
|
maxPositionals: 0
|
|
@@ -1216,19 +1218,10 @@ function readNumberOption(argv, name) {
|
|
|
1216
1218
|
const value = readOption(argv, name);
|
|
1217
1219
|
return value ? Number(value) : void 0;
|
|
1218
1220
|
}
|
|
1219
|
-
async function
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
const metadata = await stat(candidate).catch(() => null);
|
|
1224
|
-
return metadata?.isFile() ? candidate : void 0;
|
|
1225
|
-
}
|
|
1226
|
-
async function configSelectionFromArgv(argv, adjacentTo) {
|
|
1227
|
-
const path = await selectedConfigPath(argv, adjacentTo);
|
|
1228
|
-
return {
|
|
1229
|
-
config: await loadLocalRunnerConfig(path),
|
|
1230
|
-
...path ? { path } : {}
|
|
1231
|
-
};
|
|
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 } : {} };
|
|
1232
1225
|
}
|
|
1233
1226
|
async function configFromArgv(argv, adjacentTo) {
|
|
1234
1227
|
return (await configSelectionFromArgv(argv, adjacentTo)).config;
|
|
@@ -1327,7 +1320,7 @@ async function verifyActivationEvidence(model) {
|
|
|
1327
1320
|
]);
|
|
1328
1321
|
if (!hasBaseline || !hasCandidate) {
|
|
1329
1322
|
throw new Error(
|
|
1330
|
-
"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>`."
|
|
1331
1324
|
);
|
|
1332
1325
|
}
|
|
1333
1326
|
await assertArtifactManifest(join5(model.artifact_dir, "artifact-manifest.json"), {
|
|
@@ -1744,6 +1737,7 @@ async function main(argv) {
|
|
|
1744
1737
|
if (engine === "foundation" && readOption(argv, "--model")) {
|
|
1745
1738
|
throw new Error("Foundation specs do not take --model; they train a tokenizer and GPT from scratch.");
|
|
1746
1739
|
}
|
|
1740
|
+
if (readOption(argv, "--config")) throw new Error("tt init uses one tunedtensor.json; put overrides in runtime/evaluation instead of --config.");
|
|
1747
1741
|
const spec = await initLocalSpecFile({
|
|
1748
1742
|
outputPath,
|
|
1749
1743
|
name: readOption(argv, "--name") ?? (engine === "foundation" ? "Foundation chat model" : "Local Tuned Tensor Spec"),
|
|
@@ -1751,16 +1745,7 @@ async function main(argv) {
|
|
|
1751
1745
|
baseModel: engine === "foundation" ? void 0 : readOption(argv, "--model") ?? "Qwen/Qwen3.5-2B",
|
|
1752
1746
|
force: hasFlag(argv, "--force")
|
|
1753
1747
|
});
|
|
1754
|
-
const configPath =
|
|
1755
|
-
if (profile) {
|
|
1756
|
-
await initLocalRunnerConfigFile({
|
|
1757
|
-
outputPath: configPath,
|
|
1758
|
-
profile,
|
|
1759
|
-
force: hasFlag(argv, "--force")
|
|
1760
|
-
});
|
|
1761
|
-
} else if (configPath) {
|
|
1762
|
-
await loadLocalRunnerConfig(configPath);
|
|
1763
|
-
}
|
|
1748
|
+
const configPath = void 0;
|
|
1764
1749
|
printJson({
|
|
1765
1750
|
ok: true,
|
|
1766
1751
|
path: outputPath,
|
|
@@ -1812,13 +1797,13 @@ async function main(argv) {
|
|
|
1812
1797
|
}
|
|
1813
1798
|
if (command === "run") {
|
|
1814
1799
|
const inputPath = resolve3(cli.positionals[0] ?? DEFAULT_LOCAL_SPEC_PATH);
|
|
1815
|
-
const
|
|
1800
|
+
const input = await loadCliBehaviorSpec(inputPath);
|
|
1801
|
+
const configSelection = await configSelectionFromArgv(argv, inputPath, input);
|
|
1816
1802
|
const configInput = configSelection.config;
|
|
1817
1803
|
const config = localRunnerConfigSchema.parse({
|
|
1818
1804
|
...configInput,
|
|
1819
1805
|
dryRun: hasFlag(argv, "--dry-run") ? true : configInput.dryRun
|
|
1820
1806
|
});
|
|
1821
|
-
const input = await loadCliBehaviorSpec(inputPath);
|
|
1822
1807
|
assertLocalRunInputReady(input.request);
|
|
1823
1808
|
const validated = await validateLocalFineTuneInput({
|
|
1824
1809
|
request: input.request,
|
|
@@ -1846,11 +1831,12 @@ async function main(argv) {
|
|
|
1846
1831
|
}
|
|
1847
1832
|
});
|
|
1848
1833
|
}
|
|
1849
|
-
|
|
1850
|
-
request,
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}
|
|
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 });
|
|
1854
1840
|
printJson({
|
|
1855
1841
|
status: result.report.status,
|
|
1856
1842
|
run_id: result.report.run_id,
|
|
@@ -2065,6 +2051,7 @@ export {
|
|
|
2065
2051
|
parseLocalRunInput,
|
|
2066
2052
|
parseLocalRunnerConfig,
|
|
2067
2053
|
prefetchBaseModel,
|
|
2054
|
+
projectRuntimeSchema,
|
|
2068
2055
|
reportInBackground,
|
|
2069
2056
|
resolveLocalRunInputPaths,
|
|
2070
2057
|
rollbackActiveModel,
|