@tuned-tensor/cli 0.13.1-beta.3 → 0.13.1-beta.4
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 +3 -2
- package/dist/{chunk-2P2RL23O.js → chunk-7VIUHQBI.js} +994 -845
- package/dist/chunk-7VIUHQBI.js.map +1 -0
- package/dist/index.js +29 -39
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.js +32 -9
- package/dist/local-runtime.js.map +1 -1
- package/docs/local-runtime/architecture.md +4 -4
- package/examples/local-runtime/dry-runner.json +2 -2
- package/examples/local-runtime/local-runner.json +2 -2
- package/package.json +5 -5
- package/dist/chunk-2P2RL23O.js.map +0 -1
- /package/training/{local-runner → adapter}/pyproject.toml +0 -0
- /package/training/{local-runner → adapter}/src/evaluate.py +0 -0
- /package/training/{local-runner → adapter}/src/model_contract.py +0 -0
- /package/training/{local-runner → adapter}/src/prefetch.py +0 -0
- /package/training/{local-runner → adapter}/src/serve.py +0 -0
- /package/training/{local-runner → adapter}/src/sft_data.py +0 -0
- /package/training/{local-runner → adapter}/src/train.py +0 -0
- /package/training/{local-runner → adapter}/uv.lock +0 -0
package/dist/local-runtime.js
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
foundationHyperparametersSchema,
|
|
34
34
|
foundationPlaceholderIssues,
|
|
35
35
|
generatedPlaceholderIssues,
|
|
36
|
+
hardenExistingLocalStore,
|
|
36
37
|
initLocalRunnerConfigFile,
|
|
37
38
|
initLocalSpecFile,
|
|
38
39
|
isFoundationSpecFile,
|
|
@@ -71,8 +72,8 @@ import {
|
|
|
71
72
|
withBundledPythonEnvironment,
|
|
72
73
|
withHuggingFaceCacheEnvironment,
|
|
73
74
|
withOfflineHuggingFaceCacheEnvironment,
|
|
74
|
-
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
writePrivateJsonAtomic
|
|
76
|
+
} from "./chunk-7VIUHQBI.js";
|
|
76
77
|
|
|
77
78
|
// src/local-runtime/index.ts
|
|
78
79
|
import { readFileSync, realpathSync } from "fs";
|
|
@@ -604,7 +605,8 @@ async function serveLocalModel(launch) {
|
|
|
604
605
|
}
|
|
605
606
|
|
|
606
607
|
// src/local-runtime/active-model.ts
|
|
607
|
-
import {
|
|
608
|
+
import { randomUUID } from "crypto";
|
|
609
|
+
import { appendFile, chmod, readFile, rename, writeFile as writeFile2 } from "fs/promises";
|
|
608
610
|
import { join as join2 } from "path";
|
|
609
611
|
function pointerPath(store) {
|
|
610
612
|
return join2(store.root, "active-model.json");
|
|
@@ -613,6 +615,7 @@ function historyPath(store) {
|
|
|
613
615
|
return join2(store.root, "activation-history.jsonl");
|
|
614
616
|
}
|
|
615
617
|
async function readPointer(store) {
|
|
618
|
+
if (!await hardenExistingLocalStore(store.root)) return null;
|
|
616
619
|
try {
|
|
617
620
|
const value = JSON.parse(await readFile(pointerPath(store), "utf8"));
|
|
618
621
|
if (value.schema_version !== 1 || !["activate", "rollback"].includes(value.action) || value.model_id !== null && typeof value.model_id !== "string" || value.run_id !== null && typeof value.run_id !== "string" || value.previous_model_id !== null && typeof value.previous_model_id !== "string") {
|
|
@@ -624,6 +627,24 @@ async function readPointer(store) {
|
|
|
624
627
|
throw error;
|
|
625
628
|
}
|
|
626
629
|
}
|
|
630
|
+
async function writePrivatePointer(path, pointer) {
|
|
631
|
+
const temporary = `${path}.${process.pid}.${Date.now()}.${randomUUID()}.tmp`;
|
|
632
|
+
await writeFile2(temporary, `${JSON.stringify(pointer, null, 2)}
|
|
633
|
+
`, {
|
|
634
|
+
encoding: "utf8",
|
|
635
|
+
mode: 384
|
|
636
|
+
});
|
|
637
|
+
await rename(temporary, path);
|
|
638
|
+
await chmod(path, 384);
|
|
639
|
+
}
|
|
640
|
+
async function appendPrivateHistory(path, pointer) {
|
|
641
|
+
await appendFile(path, `${JSON.stringify(pointer)}
|
|
642
|
+
`, {
|
|
643
|
+
encoding: "utf8",
|
|
644
|
+
mode: 384
|
|
645
|
+
});
|
|
646
|
+
await chmod(path, 384);
|
|
647
|
+
}
|
|
627
648
|
async function assertModelCanActivate(store, modelId) {
|
|
628
649
|
const model = await store.getModel(modelId);
|
|
629
650
|
const run = await store.getRun(model.run_id);
|
|
@@ -645,9 +666,8 @@ async function assertModelCanActivate(store, modelId) {
|
|
|
645
666
|
}
|
|
646
667
|
async function publishPointer(store, pointer) {
|
|
647
668
|
await store.ensure();
|
|
648
|
-
await
|
|
649
|
-
await
|
|
650
|
-
`, "utf8");
|
|
669
|
+
await writePrivatePointer(pointerPath(store), pointer);
|
|
670
|
+
await appendPrivateHistory(historyPath(store), pointer);
|
|
651
671
|
return pointer;
|
|
652
672
|
}
|
|
653
673
|
async function getActiveModel(store) {
|
|
@@ -732,8 +752,9 @@ Global options:
|
|
|
732
752
|
-V, --version Show the installed version
|
|
733
753
|
|
|
734
754
|
The run command writes local artifacts under config.artifactRoot, defaulting to
|
|
735
|
-
.
|
|
736
|
-
~/.tuned-tensor
|
|
755
|
+
.tuned-tensor/artifacts. The file-backed local store defaults to
|
|
756
|
+
~/.tuned-tensor/store unless config.storeRoot, TT_LOCAL_HOME, or
|
|
757
|
+
TUNED_TENSOR_HOME is set.`);
|
|
737
758
|
}
|
|
738
759
|
var CONFIG_OPTION = { name: "--config", value: "path", description: "Local runner config JSON path" };
|
|
739
760
|
var VERBOSE_OPTION = { name: "--verbose", description: "Stream subprocess output" };
|
|
@@ -1724,6 +1745,7 @@ export {
|
|
|
1724
1745
|
generatedPlaceholderIssues,
|
|
1725
1746
|
getActiveModel,
|
|
1726
1747
|
getLocalRunnerInfo,
|
|
1748
|
+
hardenExistingLocalStore,
|
|
1727
1749
|
initLocalRunnerConfigFile,
|
|
1728
1750
|
initLocalSpecFile,
|
|
1729
1751
|
isFoundationSpecFile,
|
|
@@ -1755,6 +1777,7 @@ export {
|
|
|
1755
1777
|
validateLocalPipeline,
|
|
1756
1778
|
verifyLocalBaseModel,
|
|
1757
1779
|
verifyLocalModelServerLaunch,
|
|
1758
|
-
verifyModelPrefetchCacheReport
|
|
1780
|
+
verifyModelPrefetchCacheReport,
|
|
1781
|
+
writePrivateJsonAtomic
|
|
1759
1782
|
};
|
|
1760
1783
|
//# sourceMappingURL=local-runtime.js.map
|