@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/README.md
CHANGED
|
@@ -206,6 +206,13 @@ Two local engines share that document version:
|
|
|
206
206
|
`inference` evaluators. Requires a foundation `tunedtensor.json`
|
|
207
207
|
(`engine: "foundation"`, at least two examples, no `base_model`).
|
|
208
208
|
|
|
209
|
+
Both engines are spec-driven. `system_prompt`, `guidelines`, and `constraints`
|
|
210
|
+
are compiled into one canonical system instruction, and `examples` supply the
|
|
211
|
+
demonstrated behavior. Adapter training, foundation tokenizer/pretraining,
|
|
212
|
+
chat SFT, optional RL, and evaluation all receive that same compiled
|
|
213
|
+
instruction. Engine-specific fields choose how TT learns the behavior; they do
|
|
214
|
+
not redefine the behavior itself.
|
|
215
|
+
|
|
209
216
|
The foundation engine is a readable, single-GPU local trainer inspired by Andrej
|
|
210
217
|
Karpathy's [nanochat](https://github.com/karpathy/nanochat), not a port of its
|
|
211
218
|
distributed training stack. With `foundation.corpus_path`, it streams `.txt`
|
|
@@ -2519,15 +2519,17 @@ var behaviorSpecExampleSchema = z.object({
|
|
|
2519
2519
|
input: z.string().min(1),
|
|
2520
2520
|
output: z.string().min(1)
|
|
2521
2521
|
}).strict();
|
|
2522
|
-
var
|
|
2522
|
+
var behaviorSpecSchema = z.object({
|
|
2523
2523
|
name: z.string().min(1),
|
|
2524
2524
|
description: z.string().default(""),
|
|
2525
2525
|
system_prompt: z.string().default(""),
|
|
2526
2526
|
guidelines: z.array(z.string()).default([]),
|
|
2527
2527
|
examples: z.array(behaviorSpecExampleSchema).default([]),
|
|
2528
|
-
constraints: z.array(z.string()).default([])
|
|
2529
|
-
base_model: z.string().transform((value) => canonicalizeTrainingModel(value))
|
|
2528
|
+
constraints: z.array(z.string()).default([])
|
|
2530
2529
|
}).strict();
|
|
2530
|
+
var specSnapshotSchema = behaviorSpecSchema.extend({
|
|
2531
|
+
base_model: z.string().transform((value) => canonicalizeTrainingModel(value))
|
|
2532
|
+
});
|
|
2531
2533
|
var foundationHyperparametersSchema = z.object({
|
|
2532
2534
|
vocab_size: z.number().int().min(64).max(65536).default(256),
|
|
2533
2535
|
max_chars: z.number().int().min(1e3).max(1e12).default(2e4),
|
|
@@ -2555,17 +2557,12 @@ var foundationHyperparametersSchema = z.object({
|
|
|
2555
2557
|
keep_checkpoints: z.number().int().min(1).max(100).optional(),
|
|
2556
2558
|
log_interval_steps: z.number().int().min(1).max(1e6).optional()
|
|
2557
2559
|
}).strict();
|
|
2558
|
-
var localFoundationSpecFileSchema =
|
|
2560
|
+
var localFoundationSpecFileSchema = behaviorSpecSchema.extend({
|
|
2559
2561
|
engine: z.literal("foundation"),
|
|
2560
2562
|
id: z.string().uuid().optional(),
|
|
2561
|
-
name: z.string().min(1),
|
|
2562
|
-
description: z.string().default(""),
|
|
2563
|
-
system_prompt: z.string().default(""),
|
|
2564
|
-
guidelines: z.array(z.string()).default([]),
|
|
2565
2563
|
examples: z.array(behaviorSpecExampleSchema).min(2),
|
|
2566
|
-
constraints: z.array(z.string()).default([]),
|
|
2567
2564
|
foundation: foundationHyperparametersSchema
|
|
2568
|
-
})
|
|
2565
|
+
});
|
|
2569
2566
|
var datasetPrebuiltSchema = z.object({
|
|
2570
2567
|
training: z.string().min(1),
|
|
2571
2568
|
validation: z.string().min(1).optional(),
|
|
@@ -3082,14 +3079,16 @@ async function normalizeChatJsonlForRelocation(path) {
|
|
|
3082
3079
|
}
|
|
3083
3080
|
function buildSystemMessage(spec) {
|
|
3084
3081
|
const parts = [];
|
|
3082
|
+
const guidelines = spec.guidelines.map((value) => value.trim()).filter(Boolean);
|
|
3083
|
+
const constraints = spec.constraints.map((value) => value.trim()).filter(Boolean);
|
|
3085
3084
|
if (spec.system_prompt.trim()) parts.push(spec.system_prompt.trim());
|
|
3086
|
-
if (
|
|
3085
|
+
if (guidelines.length > 0) {
|
|
3087
3086
|
parts.push(`Guidelines:
|
|
3088
|
-
${
|
|
3087
|
+
${guidelines.map((guideline) => `- ${guideline}`).join("\n")}`);
|
|
3089
3088
|
}
|
|
3090
|
-
if (
|
|
3089
|
+
if (constraints.length > 0) {
|
|
3091
3090
|
parts.push(`Constraints:
|
|
3092
|
-
${
|
|
3091
|
+
${constraints.map((constraint) => `- ${constraint}`).join("\n")}`);
|
|
3093
3092
|
}
|
|
3094
3093
|
return parts.join("\n\n") || "Follow the demonstrated behavior.";
|
|
3095
3094
|
}
|
|
@@ -5777,6 +5776,7 @@ export {
|
|
|
5777
5776
|
datasetFormatSchema,
|
|
5778
5777
|
baseModelRevisionSchema,
|
|
5779
5778
|
behaviorSpecExampleSchema,
|
|
5779
|
+
behaviorSpecSchema,
|
|
5780
5780
|
specSnapshotSchema,
|
|
5781
5781
|
foundationHyperparametersSchema,
|
|
5782
5782
|
localFoundationSpecFileSchema,
|
|
@@ -5828,4 +5828,4 @@ export {
|
|
|
5828
5828
|
runLocalPipeline,
|
|
5829
5829
|
runLocalFineTune
|
|
5830
5830
|
};
|
|
5831
|
-
//# sourceMappingURL=chunk-
|
|
5831
|
+
//# sourceMappingURL=chunk-AKJ5WZ2S.js.map
|