@tuned-tensor/cli 0.13.1-beta.6 → 0.13.1-beta.7
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 +7 -0
- package/dist/{chunk-W7MOBPCO.js → chunk-AKJ5WZ2S.js} +15 -15
- package/dist/chunk-AKJ5WZ2S.js.map +1 -0
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/dist/local-runtime.js +3 -1
- package/dist/local-runtime.js.map +1 -1
- package/docs/local-runtime/architecture.md +14 -0
- package/package.json +1 -1
- package/training/foundation/src/data.py +65 -3
- package/training/foundation/src/evaluate.py +34 -8
- package/training/foundation/src/pretrain.py +15 -2
- package/training/foundation/src/rl.py +11 -3
- package/training/foundation/src/train_tokenizer.py +11 -2
- package/dist/chunk-W7MOBPCO.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
assertLocalRunInputReady,
|
|
8
8
|
assessHardware,
|
|
9
9
|
buildFoundationPythonCommand,
|
|
10
|
+
buildSystemMessage,
|
|
10
11
|
defaultStoreRoot,
|
|
11
12
|
expandUserPath,
|
|
12
13
|
formatAgentHostBlock,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
runLoggedProcess,
|
|
23
24
|
warningsFromSnapshot,
|
|
24
25
|
withFoundationPythonEnvironment
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AKJ5WZ2S.js";
|
|
26
27
|
|
|
27
28
|
// src/cli.ts
|
|
28
29
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -5139,9 +5140,20 @@ import { createHash as createHash3, randomUUID as randomUUID5 } from "crypto";
|
|
|
5139
5140
|
import { createReadStream } from "fs";
|
|
5140
5141
|
import { chmod as chmod2, lstat as lstat3, mkdir as mkdir3, open as open2, readdir as readdir3, readFile as readFile4, rename as rename2, rm as rm2 } from "fs/promises";
|
|
5141
5142
|
import { basename as basename4, dirname as dirname4, join as join7, resolve as resolve4 } from "path";
|
|
5143
|
+
var INSTRUCTION_CORPUS_VERSION = 1;
|
|
5142
5144
|
function isRef(value) {
|
|
5143
5145
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && typeof value.from === "string";
|
|
5144
5146
|
}
|
|
5147
|
+
function resumeConfigMatches(previous, current, legacySystemPrompt) {
|
|
5148
|
+
if (JSON.stringify(previous) === JSON.stringify(current)) return true;
|
|
5149
|
+
if (!previous || typeof previous !== "object" || Array.isArray(previous)) return false;
|
|
5150
|
+
const legacyInstruction = legacySystemPrompt.trim();
|
|
5151
|
+
if (!legacyInstruction || current.system_prompt !== legacyInstruction) return false;
|
|
5152
|
+
const migrated = { ...previous };
|
|
5153
|
+
if (migrated.system_prompt !== legacySystemPrompt) return false;
|
|
5154
|
+
migrated.system_prompt = legacyInstruction;
|
|
5155
|
+
return JSON.stringify(migrated) === JSON.stringify(current);
|
|
5156
|
+
}
|
|
5145
5157
|
function parseRef(value) {
|
|
5146
5158
|
const index = value.from.lastIndexOf(".");
|
|
5147
5159
|
if (index <= 0) throw new Error(`Invalid artifact reference: ${value.from}`);
|
|
@@ -5329,6 +5341,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5329
5341
|
const produced = /* @__PURE__ */ new Map();
|
|
5330
5342
|
const steps = [];
|
|
5331
5343
|
const examples = args2.spec.examples.map((example) => ({ input: example.input, output: example.output }));
|
|
5344
|
+
const systemInstruction = buildSystemMessage(args2.spec);
|
|
5332
5345
|
const hp = args2.spec.foundation;
|
|
5333
5346
|
let tokenizerDir;
|
|
5334
5347
|
let modelDir;
|
|
@@ -5364,7 +5377,8 @@ async function runFoundationPipeline(args2) {
|
|
|
5364
5377
|
vocab_size: fields.vocabSize ?? hp.vocab_size,
|
|
5365
5378
|
max_chars: hp.tokenizer_max_chars ?? fields.maxChars ?? hp.max_chars,
|
|
5366
5379
|
corpus_path: hp.corpus_path,
|
|
5367
|
-
|
|
5380
|
+
...hp.corpus_path ? { instruction_corpus_version: INSTRUCTION_CORPUS_VERSION } : {},
|
|
5381
|
+
system_prompt: systemInstruction,
|
|
5368
5382
|
examples
|
|
5369
5383
|
};
|
|
5370
5384
|
} else if (step.uses === "pretrain") {
|
|
@@ -5381,6 +5395,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5381
5395
|
nproc_per_node: fields.nprocPerNode ?? hp.nproc_per_node,
|
|
5382
5396
|
max_chars: hp.max_chars,
|
|
5383
5397
|
corpus_path: hp.corpus_path,
|
|
5398
|
+
...hp.corpus_path ? { instruction_corpus_version: INSTRUCTION_CORPUS_VERSION } : {},
|
|
5384
5399
|
seed: hp.seed,
|
|
5385
5400
|
learning_rate: hp.learning_rate,
|
|
5386
5401
|
weight_decay: hp.weight_decay,
|
|
@@ -5395,7 +5410,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5395
5410
|
log_interval_steps: hp.log_interval_steps,
|
|
5396
5411
|
checkpoint_backup_dir: hp.checkpoint_backup_dir,
|
|
5397
5412
|
resume: true,
|
|
5398
|
-
system_prompt:
|
|
5413
|
+
system_prompt: systemInstruction,
|
|
5399
5414
|
examples
|
|
5400
5415
|
};
|
|
5401
5416
|
} else if (step.uses === "finetune") {
|
|
@@ -5408,7 +5423,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5408
5423
|
steps: fields.steps ?? hp.finetune_steps,
|
|
5409
5424
|
batch_size: fields.batchSize ?? hp.batch_size,
|
|
5410
5425
|
sequence_length: hp.sequence_length,
|
|
5411
|
-
system_prompt:
|
|
5426
|
+
system_prompt: systemInstruction,
|
|
5412
5427
|
examples
|
|
5413
5428
|
};
|
|
5414
5429
|
} else if (step.uses === "rl") {
|
|
@@ -5419,7 +5434,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5419
5434
|
tokenizer_dir: tokenizerDir,
|
|
5420
5435
|
output_dir: output,
|
|
5421
5436
|
steps: fields.steps ?? hp.rl_steps,
|
|
5422
|
-
system_prompt:
|
|
5437
|
+
system_prompt: systemInstruction,
|
|
5423
5438
|
examples
|
|
5424
5439
|
};
|
|
5425
5440
|
} else if (step.uses === "evaluate") {
|
|
@@ -5433,7 +5448,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5433
5448
|
sequence_length: hp.sequence_length,
|
|
5434
5449
|
max_chars: hp.max_chars,
|
|
5435
5450
|
validation_path: hp.validation_path,
|
|
5436
|
-
system_prompt:
|
|
5451
|
+
system_prompt: systemInstruction,
|
|
5437
5452
|
examples
|
|
5438
5453
|
};
|
|
5439
5454
|
} else {
|
|
@@ -5446,7 +5461,7 @@ async function runFoundationPipeline(args2) {
|
|
|
5446
5461
|
if (args2.resume) {
|
|
5447
5462
|
try {
|
|
5448
5463
|
const previousConfig = JSON.parse(await readFile4(configPath2, "utf8"));
|
|
5449
|
-
if (
|
|
5464
|
+
if (!resumeConfigMatches(previousConfig, config, args2.spec.system_prompt)) {
|
|
5450
5465
|
throw new Error(
|
|
5451
5466
|
`Foundation step "${step.id}" configuration changed; resume requires the original spec and pipeline.`
|
|
5452
5467
|
);
|
|
@@ -6141,7 +6156,7 @@ async function runCli(version, runtime = {}) {
|
|
|
6141
6156
|
}
|
|
6142
6157
|
|
|
6143
6158
|
// src/index.ts
|
|
6144
|
-
runCli("0.13.1-beta.
|
|
6159
|
+
runCli("0.13.1-beta.7").catch((err) => {
|
|
6145
6160
|
reportError(err);
|
|
6146
6161
|
process.exit(1);
|
|
6147
6162
|
});
|