@matchbox-ai/train 0.1.0 → 0.2.1
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/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/define-pipeline-D6I-jAE_.js +20 -0
- package/dist/define-pipeline-D6I-jAE_.js.map +1 -0
- package/dist/encoders/index.d.ts +0 -1
- package/dist/encoders/index.d.ts.map +1 -1
- package/dist/evaluate-sequence-ZCwyomzQ.js.map +1 -1
- package/dist/evaluation/evaluate-sequence.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -11
- package/dist/index.js.map +1 -1
- package/dist/load-project.d.ts +0 -4
- package/dist/load-project.d.ts.map +1 -1
- package/dist/models/presets.d.ts +6 -6
- package/dist/models/presets.d.ts.map +1 -1
- package/dist/models/record/fit.d.ts +6 -99
- package/dist/models/record/fit.d.ts.map +1 -1
- package/dist/models/record/run.d.ts +1 -57
- package/dist/models/record/run.d.ts.map +1 -1
- package/dist/models/record/verify-export.d.ts +1 -2
- package/dist/models/record/verify-export.d.ts.map +1 -1
- package/dist/models/sequence/fit-sequence.d.ts +9 -116
- package/dist/models/sequence/fit-sequence.d.ts.map +1 -1
- package/dist/models/sequence/prepare-supervision.d.ts +10 -0
- package/dist/models/sequence/prepare-supervision.d.ts.map +1 -0
- package/dist/models/sequence/run-sequence.d.ts +3 -71
- package/dist/models/sequence/run-sequence.d.ts.map +1 -1
- package/dist/models/sequence/types.d.ts +4 -0
- package/dist/models/sequence/types.d.ts.map +1 -1
- package/dist/native/fit.d.ts +15 -0
- package/dist/native/fit.d.ts.map +1 -0
- package/dist/native/index.d.ts +3 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/record.d.ts +12 -0
- package/dist/native/record.d.ts.map +1 -0
- package/dist/package-model-CPj0qnQs.js.map +1 -1
- package/dist/packaging/package-model.d.ts.map +1 -1
- package/dist/pipeline/define-pipeline.d.ts +2 -5
- package/dist/pipeline/define-pipeline.d.ts.map +1 -1
- package/dist/project/artifact.d.ts +21 -67
- package/dist/project/artifact.d.ts.map +1 -1
- package/dist/project/config.d.ts +1 -4
- package/dist/project/config.d.ts.map +1 -1
- package/dist/project/discover.d.ts +2 -0
- package/dist/project/discover.d.ts.map +1 -1
- package/dist/project/entry.d.ts +5 -0
- package/dist/project/entry.d.ts.map +1 -0
- package/dist/project/index.d.ts +1 -1
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +2 -2
- package/dist/{project-BP331m20.js → project-BR13wXHr.js} +51 -18
- package/dist/project-BR13wXHr.js.map +1 -0
- package/dist/{record-BTZ5LWHF.js → record-MCYVi9O6.js} +60 -114
- package/dist/record-MCYVi9O6.js.map +1 -0
- package/dist/{run-Cwa7vD_T.js → run-PB_jiKnw.js} +4 -6
- package/dist/run-PB_jiKnw.js.map +1 -0
- package/dist/run.d.ts +4 -128
- package/dist/run.d.ts.map +1 -1
- package/dist/sequence-DGoGU7kG.js +219 -0
- package/dist/sequence-DGoGU7kG.js.map +1 -0
- package/dist/train.d.ts +4 -128
- package/dist/train.d.ts.map +1 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +12 -7
- package/docs/agent-skill.md +8 -4
- package/docs/cli.md +85 -28
- package/docs/contributing.md +43 -0
- package/docs/dataset-format.md +4 -2
- package/docs/evaluation.md +66 -5
- package/docs/example-evaluation.md +47 -0
- package/docs/example-results.json +280 -0
- package/docs/examples/money.md +19 -0
- package/docs/examples/time.md +43 -0
- package/docs/getting-started.md +48 -54
- package/docs/native-packages.md +31 -0
- package/docs/neural-training.md +1 -1
- package/docs/parser-api.md +16 -16
- package/docs/pipelines.md +5 -6
- package/docs/primitives/README.md +12 -11
- package/docs/project-structure.md +17 -3
- package/docs/react.md +49 -7
- package/docs/reference/README.md +25 -0
- package/docs/reference/configuration.md +43 -0
- package/docs/reference/evaluation.md +21 -0
- package/docs/reference/pipeline.md +43 -0
- package/docs/reference/runtime.md +56 -0
- package/docs/reference/supervision.md +87 -0
- package/docs/reference/training.md +26 -0
- package/docs/reference/vite.md +20 -0
- package/docs/releases.md +6 -16
- package/docs/repository-design.md +2 -2
- package/docs/runtime-backends.md +8 -11
- package/docs/training.md +73 -0
- package/docs/website-deployment.md +11 -0
- package/native.cjs +1 -0
- package/package.json +10 -5
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-arm64/node.napi.musl.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/dist/define-pipeline-Colvwt7u.js +0 -32
- package/dist/define-pipeline-Colvwt7u.js.map +0 -1
- package/dist/encoders/word-tokens.d.ts +0 -5
- package/dist/encoders/word-tokens.d.ts.map +0 -1
- package/dist/models/sequence/create-network.d.ts +0 -3
- package/dist/models/sequence/create-network.d.ts.map +0 -1
- package/dist/project-BP331m20.js.map +0 -1
- package/dist/record-BTZ5LWHF.js.map +0 -1
- package/dist/run-Cwa7vD_T.js.map +0 -1
- package/dist/sequence-C_WfVGO1.js +0 -251
- package/dist/sequence-C_WfVGO1.js.map +0 -1
- package/docs/filter-research.md +0 -63
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
import { t as evaluateSequence } from "./evaluate-sequence-ZCwyomzQ.js";
|
|
2
2
|
import { t as packageModel } from "./package-model-CPj0qnQs.js";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
3
4
|
import { readRecordArtifact, recordFeatures, recordTokens, tensorPredictor } from "@matchbox-ai/core/internal";
|
|
4
5
|
import { dirname, relative } from "node:path";
|
|
5
6
|
import { createParser } from "@matchbox-ai/core/runtime";
|
|
6
7
|
import { createHash } from "node:crypto";
|
|
7
|
-
|
|
8
|
+
//#region src/native/record.ts
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
function fitNativeRecord(config, inputs, labels, progress) {
|
|
11
|
+
return require("#native").fitRecord(JSON.stringify(config), Float32Array.from(inputs.flat()), Int32Array.from(labels), (error, values) => {
|
|
12
|
+
if (!error) progress?.(values[0], values[1]);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function predictNativeRecord(config, weights, inputs) {
|
|
16
|
+
return require("#native").predictRecord(JSON.stringify(config), Buffer.from(weights), Float32Array.from(inputs));
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
8
19
|
//#region src/models/record/verify-export.ts
|
|
9
|
-
async function verifyExport(
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const probabilities = Array.from(tf.softmax(tf.slice(logits, [0, offset], [1, field.values.length])).dataSync());
|
|
15
|
-
offset += field.values.length;
|
|
16
|
-
return probabilities;
|
|
17
|
-
});
|
|
18
|
-
}));
|
|
20
|
+
async function verifyExport(weights, artifact, probes) {
|
|
21
|
+
const config = {
|
|
22
|
+
vocabularySize: artifact.vocabulary.length,
|
|
23
|
+
fields: artifact.fields.map((field) => field.values.length)
|
|
24
|
+
};
|
|
19
25
|
const predictor = await tensorPredictor(artifact);
|
|
20
26
|
let maxConfidenceError = 0;
|
|
21
27
|
let labelDisagreements = 0;
|
|
22
28
|
try {
|
|
23
|
-
|
|
29
|
+
for (const input of probes) {
|
|
30
|
+
const native = predictNativeRecord(config, weights, recordFeatures(input, artifact.vocabulary));
|
|
31
|
+
let offset = 0;
|
|
24
32
|
predictor.record(input).fields.forEach((prediction, index) => {
|
|
25
|
-
const
|
|
33
|
+
const field = artifact.fields[index];
|
|
34
|
+
const scores = native.slice(offset, offset + field.values.length);
|
|
35
|
+
offset += field.values.length;
|
|
26
36
|
const maximum = Math.max(...scores);
|
|
27
37
|
maxConfidenceError = Math.max(maxConfidenceError, Math.abs(maximum - prediction.confidence));
|
|
28
|
-
if (prediction.value !==
|
|
38
|
+
if (prediction.value !== field.values[scores.indexOf(maximum)]) labelDisagreements++;
|
|
29
39
|
});
|
|
30
|
-
}
|
|
40
|
+
}
|
|
31
41
|
} finally {
|
|
32
42
|
predictor.dispose();
|
|
33
|
-
await tf.setBackend("tensorflow");
|
|
34
43
|
}
|
|
35
|
-
if (labelDisagreements || maxConfidenceError > 1e-5) throw new Error("
|
|
44
|
+
if (labelDisagreements || maxConfidenceError > 1e-5) throw new Error("Burn native and WASM record predictions disagree.");
|
|
36
45
|
return {
|
|
37
46
|
examples: probes.length,
|
|
38
47
|
labelDisagreements,
|
|
@@ -59,88 +68,32 @@ async function fitRecord(examples, metadata, probes, progress) {
|
|
|
59
68
|
};
|
|
60
69
|
});
|
|
61
70
|
const vocabulary = [...new Set(examples.flatMap((row) => recordTokens(row.input)))].sort();
|
|
62
|
-
const outputs = fields.reduce((sum, field) => sum + field.values.length, 0);
|
|
63
71
|
if (fields.length > 32 || fields.some((field) => field.values.length > 256) || vocabulary.length > 1e4) throw new Error("Default trainer capacity exceeded. Use a custom pipeline for larger output domains.");
|
|
64
|
-
await
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const losses = fields.map((field) => {
|
|
81
|
-
const count = field.values.length;
|
|
82
|
-
const target = tf.slice(gold, [0, offset], [-1, count]);
|
|
83
|
-
const scores = tf.slice(logits, [0, offset], [-1, count]);
|
|
84
|
-
offset += count;
|
|
85
|
-
return tf.neg(tf.sum(tf.mul(target, tf.logSoftmax(scores)), 1));
|
|
86
|
-
});
|
|
87
|
-
return tf.mean(tf.addN(losses));
|
|
88
|
-
})
|
|
72
|
+
const result = await fitNativeRecord({
|
|
73
|
+
vocabularySize: vocabulary.length,
|
|
74
|
+
fields: fields.map((field) => field.values.length)
|
|
75
|
+
}, examples.map((row) => recordFeatures(row.input, vocabulary)), examples.flatMap((row) => fields.map((field) => field.values.indexOf(row.output[field.name]))), progress);
|
|
76
|
+
const artifact = (weights) => readRecordArtifact({
|
|
77
|
+
formatVersion: 3,
|
|
78
|
+
engine: "burn-0.21",
|
|
79
|
+
kind: "record-parser",
|
|
80
|
+
architecture: "bag-of-words-mlp",
|
|
81
|
+
...metadata,
|
|
82
|
+
decoderModule: null,
|
|
83
|
+
fields,
|
|
84
|
+
vocabulary,
|
|
85
|
+
threshold: .75,
|
|
86
|
+
precision: "float32",
|
|
87
|
+
weights: Buffer.from(weights).toString("base64")
|
|
89
88
|
});
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
shape: tensor.shape,
|
|
99
|
-
values: precision === "int8" ? values.map((value) => Math.round(value / scale)) : values,
|
|
100
|
-
scale
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
return readRecordArtifact({
|
|
104
|
-
formatVersion: 2,
|
|
105
|
-
kind: "record-parser",
|
|
106
|
-
architecture: "bag-of-words-mlp",
|
|
107
|
-
...metadata,
|
|
108
|
-
modelTopology: JSON.parse(model.toJSON()),
|
|
109
|
-
decoderModule: null,
|
|
110
|
-
fields,
|
|
111
|
-
vocabulary,
|
|
112
|
-
threshold: .75,
|
|
113
|
-
precision,
|
|
114
|
-
weights
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
const untrained = exported("float32");
|
|
118
|
-
const history = [];
|
|
119
|
-
try {
|
|
120
|
-
await model.fit(x, y, {
|
|
121
|
-
epochs: 100,
|
|
122
|
-
batchSize: 128,
|
|
123
|
-
shuffle: false,
|
|
124
|
-
verbose: 0,
|
|
125
|
-
callbacks: { onEpochEnd(epoch, logs) {
|
|
126
|
-
history.push(Number(logs?.loss));
|
|
127
|
-
progress?.(epoch + 1, Number(logs?.loss));
|
|
128
|
-
} }
|
|
129
|
-
});
|
|
130
|
-
const float = exported("float32");
|
|
131
|
-
return {
|
|
132
|
-
float,
|
|
133
|
-
quantized: exported("int8"),
|
|
134
|
-
untrained,
|
|
135
|
-
history,
|
|
136
|
-
parity: await verifyExport(model, float, probes)
|
|
137
|
-
};
|
|
138
|
-
} finally {
|
|
139
|
-
x.dispose();
|
|
140
|
-
y.dispose();
|
|
141
|
-
model.dispose();
|
|
142
|
-
optimizer.dispose();
|
|
143
|
-
}
|
|
89
|
+
const model = artifact(result.weights);
|
|
90
|
+
const parity = await verifyExport(result.weights, model, probes);
|
|
91
|
+
return {
|
|
92
|
+
model,
|
|
93
|
+
parameters: result.parameters,
|
|
94
|
+
history: result.loss,
|
|
95
|
+
parity
|
|
96
|
+
};
|
|
144
97
|
}
|
|
145
98
|
//#endregion
|
|
146
99
|
//#region src/models/record/run.ts
|
|
@@ -159,17 +112,17 @@ async function runRecord(project, progress) {
|
|
|
159
112
|
parser.dispose();
|
|
160
113
|
}
|
|
161
114
|
};
|
|
162
|
-
const validation = await evaluate(fit.
|
|
163
|
-
const bytes = Buffer.byteLength(JSON.stringify(fit.
|
|
115
|
+
const validation = await evaluate(fit.model, project.validation);
|
|
116
|
+
const bytes = Buffer.byteLength(JSON.stringify(fit.model));
|
|
164
117
|
if (validation.exactAccuracy < project.config.minAccuracy || bytes > project.config.maxBytes) throw new Error(`Record model failed validation/size requirements (${validation.exactAccuracy}, ${bytes} bytes). ${JSON.stringify(validation.failures.slice(0, 10))}`);
|
|
165
118
|
const report = {
|
|
166
|
-
formatVersion:
|
|
167
|
-
architecture: fit.
|
|
168
|
-
backend: "
|
|
119
|
+
formatVersion: 2,
|
|
120
|
+
architecture: fit.model.architecture,
|
|
121
|
+
backend: "Burn native CPU",
|
|
169
122
|
seed: 42,
|
|
170
|
-
artifactSha256: createHash("sha256").update(JSON.stringify(fit.
|
|
123
|
+
artifactSha256: createHash("sha256").update(JSON.stringify(fit.model)).digest("hex"),
|
|
171
124
|
bytes,
|
|
172
|
-
parameters: fit.
|
|
125
|
+
parameters: fit.parameters,
|
|
173
126
|
datasetSha256: project.sources.map((source) => ({
|
|
174
127
|
source: source.source,
|
|
175
128
|
sha256: createHash("sha256").update(source.text).digest("hex")
|
|
@@ -182,18 +135,11 @@ async function runRecord(project, progress) {
|
|
|
182
135
|
loss: fit.history,
|
|
183
136
|
exportParity: fit.parity,
|
|
184
137
|
validation,
|
|
185
|
-
|
|
186
|
-
float: await evaluate(fit.float),
|
|
187
|
-
untrained: await evaluate(fit.untrained),
|
|
188
|
-
untrainedUngated: await evaluate({
|
|
189
|
-
...fit.untrained,
|
|
190
|
-
threshold: 0
|
|
191
|
-
}),
|
|
192
|
-
baseline: project.baseline ? await evaluateSequence(project.baseline, project.evaluation, (value) => project.task.validateOutput(value).success) : null,
|
|
138
|
+
evaluation: await evaluate(fit.model),
|
|
193
139
|
trainingMs: performance.now() - start,
|
|
194
140
|
notes: "Each field classifies values present in training data. Vocabulary and value domains are fitted only on training. There are no number dictionaries, aliases, normalization rules, or span annotations. Unknown tokens abstain. Bag-of-words ignores order. Confidence is uncalibrated. This model cannot emit unseen numeric values."
|
|
195
141
|
};
|
|
196
|
-
await packageModel(project.output, fit.
|
|
142
|
+
await packageModel(project.output, fit.model, report);
|
|
197
143
|
return {
|
|
198
144
|
report,
|
|
199
145
|
output: project.output
|
|
@@ -202,4 +148,4 @@ async function runRecord(project, progress) {
|
|
|
202
148
|
//#endregion
|
|
203
149
|
export { runRecord };
|
|
204
150
|
|
|
205
|
-
//# sourceMappingURL=record-
|
|
151
|
+
//# sourceMappingURL=record-MCYVi9O6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-MCYVi9O6.js","names":[],"sources":["../src/native/record.ts","../src/models/record/verify-export.ts","../src/models/record/fit.ts","../src/models/record/run.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nconst require = createRequire(import.meta.url);\ntype Config = { vocabularySize: number; fields: number[] };\ninterface Native {\n fitRecord(\n config: string,\n inputs: Float32Array,\n labels: Int32Array,\n progress: (error: Error | null, values: number[]) => void,\n ): Promise<{ parameters: number; weights: Uint8Array; loss: number[] }>;\n predictRecord(config: string, weights: Buffer, inputs: Float32Array): number[];\n}\nexport function fitNativeRecord(\n config: Config,\n inputs: number[][],\n labels: number[],\n progress?: (epoch: number, loss: number) => void,\n) {\n const native = require(\"#native\") as Native;\n return native.fitRecord(\n JSON.stringify(config),\n Float32Array.from(inputs.flat()),\n Int32Array.from(labels),\n (error, values) => {\n if (!error) {\n progress?.(values[0]!, values[1]!);\n }\n },\n );\n}\nexport function predictNativeRecord(config: Config, weights: Uint8Array, inputs: number[]) {\n return (require(\"#native\") as Native).predictRecord(\n JSON.stringify(config),\n Buffer.from(weights),\n Float32Array.from(inputs),\n );\n}\n","import { predictNativeRecord } from \"../../native/index.js\";\nimport { recordFeatures, tensorPredictor } from \"@matchbox-ai/core/internal\";\nimport type { RecordArtifact } from \"@matchbox-ai/core/internal\";\nexport async function verifyExport(\n weights: Uint8Array,\n artifact: RecordArtifact,\n probes: readonly string[],\n) {\n const config = {\n vocabularySize: artifact.vocabulary.length,\n fields: artifact.fields.map((field) => field.values.length),\n };\n const predictor = await tensorPredictor(artifact);\n let maxConfidenceError = 0;\n let labelDisagreements = 0;\n try {\n for (const input of probes) {\n const native = predictNativeRecord(\n config,\n weights,\n recordFeatures(input, artifact.vocabulary),\n );\n let offset = 0;\n predictor.record(input).fields.forEach((prediction, index) => {\n const field = artifact.fields[index]!;\n const scores = native.slice(offset, offset + field.values.length);\n offset += field.values.length;\n const maximum = Math.max(...scores);\n maxConfidenceError = Math.max(\n maxConfidenceError,\n Math.abs(maximum - prediction.confidence),\n );\n if (prediction.value !== field.values[scores.indexOf(maximum)]) {\n labelDisagreements++;\n }\n });\n }\n } finally {\n predictor.dispose();\n }\n if (labelDisagreements || maxConfidenceError > 1e-5) {\n throw new Error(\"Burn native and WASM record predictions disagree.\");\n }\n return { examples: probes.length, labelDisagreements, maxConfidenceError };\n}\n","import { verifyExport } from \"./verify-export.js\";\nimport { fitNativeRecord } from \"../../native/index.js\";\nimport { recordFeatures, recordTokens, readRecordArtifact } from \"@matchbox-ai/core/internal\";\nimport type { RecordArtifact } from \"@matchbox-ai/core/internal\";\nimport type { DatasetExample, ParserMetadata } from \"@matchbox-ai/core\";\nexport async function fitRecord(\n examples: readonly DatasetExample<unknown>[],\n metadata: { taskModule: string; taskMetadata: ParserMetadata },\n probes: readonly string[],\n progress?: (epoch: number, loss: number) => void,\n) {\n const schema = metadata.taskMetadata.output;\n if (schema.type !== \"object\" || !schema.properties || schema.additionalProperties !== false) {\n throw new Error(\n \"The default trainer currently supports strict flat objects with primitive field values. Use an explicit sequence pipeline for other shapes.\",\n );\n }\n const fields = Object.keys(schema.properties).map((name) => {\n const values = [\n ...new Map(\n examples.map((row) => {\n const value = (row.output as Record<string, unknown>)[name];\n if (value !== null && ![\"number\", \"string\", \"boolean\"].includes(typeof value)) {\n throw new Error(`output.${name}: the default trainer requires primitive field values.`);\n }\n return [JSON.stringify(value), value as string | number | boolean | null] as const;\n }),\n ).entries(),\n ]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([, value]) => value);\n return { name, values };\n });\n const vocabulary = [...new Set(examples.flatMap((row) => recordTokens(row.input)))].sort();\n if (\n fields.length > 32 ||\n fields.some((field) => field.values.length > 256) ||\n vocabulary.length > 10000\n ) {\n throw new Error(\n \"Default trainer capacity exceeded. Use a custom pipeline for larger output domains.\",\n );\n }\n const config = {\n vocabularySize: vocabulary.length,\n fields: fields.map((field) => field.values.length),\n };\n const result = await fitNativeRecord(\n config,\n examples.map((row) => recordFeatures(row.input, vocabulary)),\n examples.flatMap((row) =>\n fields.map((field) =>\n field.values.indexOf(\n (row.output as Record<string, string | number | boolean | null>)[field.name]!,\n ),\n ),\n ),\n progress,\n );\n const artifact = (weights: Uint8Array): RecordArtifact =>\n readRecordArtifact({\n formatVersion: 3,\n engine: \"burn-0.21\",\n kind: \"record-parser\",\n architecture: \"bag-of-words-mlp\",\n ...metadata,\n decoderModule: null,\n fields,\n vocabulary,\n threshold: 0.75,\n precision: \"float32\",\n weights: Buffer.from(weights).toString(\"base64\"),\n });\n const model = artifact(result.weights);\n const parity = await verifyExport(result.weights, model, probes);\n return {\n model,\n parameters: result.parameters,\n history: result.loss,\n parity,\n };\n}\n","import { createHash } from \"node:crypto\";\nimport { dirname, relative } from \"node:path\";\nimport { createParser } from \"@matchbox-ai/core/runtime\";\nimport type { RecordArtifact } from \"@matchbox-ai/core/internal\";\nimport type { loadProject } from \"../../load-project.js\";\nimport { packageModel } from \"../../packaging/package-model.js\";\nimport { evaluateSequence } from \"../../evaluation/evaluate-sequence.js\";\nimport { fitRecord } from \"./fit.js\";\nexport async function runRecord(\n project: Awaited<ReturnType<typeof loadProject>>,\n progress?: (epoch: number, loss: number) => void,\n) {\n const start = performance.now();\n const taskModule = relative(dirname(project.output), project.taskPath).replaceAll(\"\\\\\", \"/\");\n const fit = await fitRecord(\n project.train,\n {\n taskModule: taskModule.startsWith(\".\") ? taskModule : `./${taskModule}`,\n taskMetadata: project.task.toJSON(),\n },\n project.validation.map((row) => row.input),\n progress,\n );\n const evaluate = async (artifact: RecordArtifact, rows = project.evaluation) => {\n const parser = createParser(artifact, project.task);\n try {\n return await evaluateSequence(\n parser,\n rows,\n (value) => project.task.validateOutput(value).success,\n );\n } finally {\n parser.dispose();\n }\n };\n const validation = await evaluate(fit.model, project.validation);\n const bytes = Buffer.byteLength(JSON.stringify(fit.model));\n if (validation.exactAccuracy < project.config.minAccuracy || bytes > project.config.maxBytes) {\n throw new Error(\n `Record model failed validation/size requirements (${validation.exactAccuracy}, ${bytes} bytes). ${JSON.stringify(validation.failures.slice(0, 10))}`,\n );\n }\n const report = {\n formatVersion: 2,\n architecture: fit.model.architecture,\n backend: \"Burn native CPU\",\n seed: 42,\n artifactSha256: createHash(\"sha256\").update(JSON.stringify(fit.model)).digest(\"hex\"),\n bytes,\n parameters: fit.parameters,\n datasetSha256: project.sources.map((source) => ({\n source: source.source,\n sha256: createHash(\"sha256\").update(source.text).digest(\"hex\"),\n })),\n examples: {\n train: project.train.length,\n validation: project.validation.length,\n eval: project.evaluation.length,\n },\n loss: fit.history,\n exportParity: fit.parity,\n validation,\n evaluation: await evaluate(fit.model),\n trainingMs: performance.now() - start,\n notes:\n \"Each field classifies values present in training data. Vocabulary and value domains are fitted only on training. There are no number dictionaries, aliases, normalization rules, or span annotations. Unknown tokens abstain. Bag-of-words ignores order. Confidence is uncalibrated. This model cannot emit unseen numeric values.\",\n };\n await packageModel(project.output, fit.model, report);\n return { report, output: project.output };\n}\n"],"mappings":";;;;;;;;AACA,MAAM,UAAU,cAAc,YAAY,GAAG;AAW7C,SAAgB,gBACd,QACA,QACA,QACA,UACA;CAEA,OADe,QAAQ,SACX,CAAC,CAAC,UACZ,KAAK,UAAU,MAAM,GACrB,aAAa,KAAK,OAAO,KAAK,CAAC,GAC/B,WAAW,KAAK,MAAM,IACrB,OAAO,WAAW;EACjB,IAAI,CAAC,OACH,WAAW,OAAO,IAAK,OAAO,EAAG;CAErC,CACF;AACF;AACA,SAAgB,oBAAoB,QAAgB,SAAqB,QAAkB;CACzF,OAAQ,QAAQ,SAAS,CAAC,CAAY,cACpC,KAAK,UAAU,MAAM,GACrB,OAAO,KAAK,OAAO,GACnB,aAAa,KAAK,MAAM,CAC1B;AACF;;;ACjCA,eAAsB,aACpB,SACA,UACA,QACA;CACA,MAAM,SAAS;EACb,gBAAgB,SAAS,WAAW;EACpC,QAAQ,SAAS,OAAO,KAAK,UAAU,MAAM,OAAO,MAAM;CAC5D;CACA,MAAM,YAAY,MAAM,gBAAgB,QAAQ;CAChD,IAAI,qBAAqB;CACzB,IAAI,qBAAqB;CACzB,IAAI;EACF,KAAK,MAAM,SAAS,QAAQ;GAC1B,MAAM,SAAS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
|
|
1
|
+
import { i as loadConfig } from "./project-BR13wXHr.js";
|
|
2
2
|
import "zod";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { resolve } from "node:path";
|
|
@@ -9,7 +9,6 @@ async function loadProject(path) {
|
|
|
9
9
|
const { config, root } = await loadConfig(path);
|
|
10
10
|
const taskPath = resolve(root, config.task);
|
|
11
11
|
const task = (await import(pathToFileURL(taskPath).href)).default;
|
|
12
|
-
const baseline = config.baseline ? (await import(pathToFileURL(resolve(root, config.baseline)).href)).default : null;
|
|
13
12
|
const sources = await Promise.all([
|
|
14
13
|
config.train,
|
|
15
14
|
config.validation,
|
|
@@ -45,7 +44,6 @@ async function loadProject(path) {
|
|
|
45
44
|
root,
|
|
46
45
|
config,
|
|
47
46
|
task,
|
|
48
|
-
baseline,
|
|
49
47
|
taskPath,
|
|
50
48
|
output: resolve(root, config.output),
|
|
51
49
|
sources,
|
|
@@ -59,14 +57,14 @@ async function loadProject(path) {
|
|
|
59
57
|
async function run(command, path, progress) {
|
|
60
58
|
const project = await loadProject(path);
|
|
61
59
|
if (project.config.sequence) {
|
|
62
|
-
const { runSequence } = await import("./sequence-
|
|
60
|
+
const { runSequence } = await import("./sequence-DGoGU7kG.js");
|
|
63
61
|
return runSequence(command, project, progress);
|
|
64
62
|
}
|
|
65
63
|
if (command !== "train") throw new Error("Use the eval CLI command to evaluate a saved artifact.");
|
|
66
|
-
const { runRecord } = await import("./record-
|
|
64
|
+
const { runRecord } = await import("./record-MCYVi9O6.js");
|
|
67
65
|
return runRecord(project, progress);
|
|
68
66
|
}
|
|
69
67
|
//#endregion
|
|
70
68
|
export { run };
|
|
71
69
|
|
|
72
|
-
//# sourceMappingURL=run-
|
|
70
|
+
//# sourceMappingURL=run-PB_jiKnw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-PB_jiKnw.js","names":[],"sources":["../src/load-project.ts","../src/run.ts"],"sourcesContent":["import { loadConfig } from \"./project/index.js\";\nimport { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { z } from \"zod\";\nimport { parseDatasets } from \"@matchbox-ai/core\";\nimport type { ParserDefinition } from \"@matchbox-ai/core\";\nexport async function loadProject(path: string) {\n const { config, root } = await loadConfig(path);\n const taskPath = resolve(root, config.task);\n const task: ParserDefinition<z.ZodType> = (await import(pathToFileURL(taskPath).href)).default;\n const sources = await Promise.all(\n [config.train, config.validation, config.eval].map(async (source) => ({\n source,\n text: await readFile(resolve(root, source), \"utf8\"),\n })),\n );\n const training = parseDatasets(task, { formatVersion: 1, train: sources[0]!, eval: sources[1]! });\n const evaluation = parseDatasets(task, {\n formatVersion: 1,\n train: sources[0]!,\n eval: sources[2]!,\n });\n for (const result of [training, evaluation]) {\n if (!result.success) {\n throw new Error(\n result.issues\n .map((issue) => `${issue.source}:${issue.line} ${issue.path.join(\".\")}: ${issue.message}`)\n .join(\"\\n\"),\n );\n }\n }\n if (!training.success || !evaluation.success) {\n throw new Error(\"Invalid datasets.\");\n }\n const groups = [training.data.train, training.data.eval, evaluation.data.eval];\n const seen = new Map<string, number>();\n groups.forEach((group, split) =>\n group.forEach((row) => {\n const key = row.input.trim().toLowerCase();\n if (seen.has(key) && seen.get(key) !== split) {\n throw new Error(`Input overlaps dataset splits: ${row.input}`);\n }\n seen.set(key, split);\n }),\n );\n return {\n root,\n config,\n task,\n taskPath,\n output: resolve(root, config.output),\n sources,\n train: training.data.train,\n validation: training.data.eval,\n evaluation: evaluation.data.eval,\n };\n}\n","import { loadProject } from \"./load-project.js\";\nexport async function run(\n command: \"train\" | \"eval\",\n path: string,\n progress?: (epoch: number, loss: number) => void,\n) {\n const project = await loadProject(path);\n if (project.config.sequence) {\n const { runSequence } = await import(\"./models/sequence/index.js\");\n return runSequence(command, project, progress);\n }\n if (command !== \"train\") {\n throw new Error(\"Use the eval CLI command to evaluate a saved artifact.\");\n }\n const { runRecord } = await import(\"./models/record/index.js\");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KAAK,IAAI,KAAK,KAAK;CACrB,CAAC,CACH;CACA,OAAO;EACL;EACA;EACA;EACA;EACA,QAAQ,QAAQ,MAAM,OAAO,MAAM;EACnC;EACA,OAAO,SAAS,KAAK;EACrB,YAAY,SAAS,KAAK;EAC1B,YAAY,WAAW,KAAK;CAC9B;AACF;;;ACxDA,eAAsB,IACpB,SACA,MACA,UACA;CACA,MAAM,UAAU,MAAM,YAAY,IAAI;CACtC,IAAI,QAAQ,OAAO,UAAU;EAC3B,MAAM,EAAE,gBAAgB,MAAM,OAAO;EACrC,OAAO,YAAY,SAAS,SAAS,QAAQ;CAC/C;CACA,IAAI,YAAY,SACd,MAAM,IAAI,MAAM,wDAAwD;CAE1E,MAAM,EAAE,cAAc,MAAM,OAAO;CACnC,OAAO,UAAU,SAAS,QAAQ;AACpC"}
|
package/dist/run.d.ts
CHANGED
|
@@ -31,23 +31,11 @@ export declare function run(command: "train" | "eval", path: string, progress?:
|
|
|
31
31
|
}[];
|
|
32
32
|
examples: {
|
|
33
33
|
train: number;
|
|
34
|
+
rejections: number;
|
|
34
35
|
validation: number;
|
|
35
36
|
eval: number;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
-
examples: number;
|
|
39
|
-
invalidOutputRate: number;
|
|
40
|
-
exactAccuracy: number;
|
|
41
|
-
accepted: number;
|
|
42
|
-
acceptedAccuracy: number | null;
|
|
43
|
-
abstentionRate: number;
|
|
44
|
-
correctAbstentions: number;
|
|
45
|
-
failures: {
|
|
46
|
-
input: string;
|
|
47
|
-
expected: unknown;
|
|
48
|
-
actual: unknown;
|
|
49
|
-
}[];
|
|
50
|
-
} | null;
|
|
38
|
+
supervisionSha256: string;
|
|
51
39
|
supervisedTokens: number;
|
|
52
40
|
loss: number[];
|
|
53
41
|
exportParity: {
|
|
@@ -69,49 +57,7 @@ export declare function run(command: "train" | "eval", path: string, progress?:
|
|
|
69
57
|
actual: unknown;
|
|
70
58
|
}[];
|
|
71
59
|
};
|
|
72
|
-
|
|
73
|
-
examples: number;
|
|
74
|
-
invalidOutputRate: number;
|
|
75
|
-
exactAccuracy: number;
|
|
76
|
-
accepted: number;
|
|
77
|
-
acceptedAccuracy: number | null;
|
|
78
|
-
abstentionRate: number;
|
|
79
|
-
correctAbstentions: number;
|
|
80
|
-
failures: {
|
|
81
|
-
input: string;
|
|
82
|
-
expected: unknown;
|
|
83
|
-
actual: unknown;
|
|
84
|
-
}[];
|
|
85
|
-
};
|
|
86
|
-
untrained: {
|
|
87
|
-
examples: number;
|
|
88
|
-
invalidOutputRate: number;
|
|
89
|
-
exactAccuracy: number;
|
|
90
|
-
accepted: number;
|
|
91
|
-
acceptedAccuracy: number | null;
|
|
92
|
-
abstentionRate: number;
|
|
93
|
-
correctAbstentions: number;
|
|
94
|
-
failures: {
|
|
95
|
-
input: string;
|
|
96
|
-
expected: unknown;
|
|
97
|
-
actual: unknown;
|
|
98
|
-
}[];
|
|
99
|
-
};
|
|
100
|
-
float: {
|
|
101
|
-
examples: number;
|
|
102
|
-
invalidOutputRate: number;
|
|
103
|
-
exactAccuracy: number;
|
|
104
|
-
accepted: number;
|
|
105
|
-
acceptedAccuracy: number | null;
|
|
106
|
-
abstentionRate: number;
|
|
107
|
-
correctAbstentions: number;
|
|
108
|
-
failures: {
|
|
109
|
-
input: string;
|
|
110
|
-
expected: unknown;
|
|
111
|
-
actual: unknown;
|
|
112
|
-
}[];
|
|
113
|
-
};
|
|
114
|
-
quantized: {
|
|
60
|
+
evaluation: {
|
|
115
61
|
examples: number;
|
|
116
62
|
invalidOutputRate: number;
|
|
117
63
|
exactAccuracy: number;
|
|
@@ -139,20 +85,6 @@ export declare function run(command: "train" | "eval", path: string, progress?:
|
|
|
139
85
|
actual: unknown;
|
|
140
86
|
}[];
|
|
141
87
|
} | null;
|
|
142
|
-
baseline: {
|
|
143
|
-
examples: number;
|
|
144
|
-
invalidOutputRate: number;
|
|
145
|
-
exactAccuracy: number;
|
|
146
|
-
accepted: number;
|
|
147
|
-
acceptedAccuracy: number | null;
|
|
148
|
-
abstentionRate: number;
|
|
149
|
-
correctAbstentions: number;
|
|
150
|
-
failures: {
|
|
151
|
-
input: string;
|
|
152
|
-
expected: unknown;
|
|
153
|
-
actual: unknown;
|
|
154
|
-
}[];
|
|
155
|
-
} | null;
|
|
156
88
|
trainingMs: number;
|
|
157
89
|
notes: string;
|
|
158
90
|
};
|
|
@@ -195,35 +127,7 @@ export declare function run(command: "train" | "eval", path: string, progress?:
|
|
|
195
127
|
actual: unknown;
|
|
196
128
|
}[];
|
|
197
129
|
};
|
|
198
|
-
|
|
199
|
-
examples: number;
|
|
200
|
-
invalidOutputRate: number;
|
|
201
|
-
exactAccuracy: number;
|
|
202
|
-
accepted: number;
|
|
203
|
-
acceptedAccuracy: number | null;
|
|
204
|
-
abstentionRate: number;
|
|
205
|
-
correctAbstentions: number;
|
|
206
|
-
failures: {
|
|
207
|
-
input: string;
|
|
208
|
-
expected: unknown;
|
|
209
|
-
actual: unknown;
|
|
210
|
-
}[];
|
|
211
|
-
};
|
|
212
|
-
float: {
|
|
213
|
-
examples: number;
|
|
214
|
-
invalidOutputRate: number;
|
|
215
|
-
exactAccuracy: number;
|
|
216
|
-
accepted: number;
|
|
217
|
-
acceptedAccuracy: number | null;
|
|
218
|
-
abstentionRate: number;
|
|
219
|
-
correctAbstentions: number;
|
|
220
|
-
failures: {
|
|
221
|
-
input: string;
|
|
222
|
-
expected: unknown;
|
|
223
|
-
actual: unknown;
|
|
224
|
-
}[];
|
|
225
|
-
};
|
|
226
|
-
untrained: {
|
|
130
|
+
evaluation: {
|
|
227
131
|
examples: number;
|
|
228
132
|
invalidOutputRate: number;
|
|
229
133
|
exactAccuracy: number;
|
|
@@ -237,34 +141,6 @@ export declare function run(command: "train" | "eval", path: string, progress?:
|
|
|
237
141
|
actual: unknown;
|
|
238
142
|
}[];
|
|
239
143
|
};
|
|
240
|
-
untrainedUngated: {
|
|
241
|
-
examples: number;
|
|
242
|
-
invalidOutputRate: number;
|
|
243
|
-
exactAccuracy: number;
|
|
244
|
-
accepted: number;
|
|
245
|
-
acceptedAccuracy: number | null;
|
|
246
|
-
abstentionRate: number;
|
|
247
|
-
correctAbstentions: number;
|
|
248
|
-
failures: {
|
|
249
|
-
input: string;
|
|
250
|
-
expected: unknown;
|
|
251
|
-
actual: unknown;
|
|
252
|
-
}[];
|
|
253
|
-
};
|
|
254
|
-
baseline: {
|
|
255
|
-
examples: number;
|
|
256
|
-
invalidOutputRate: number;
|
|
257
|
-
exactAccuracy: number;
|
|
258
|
-
accepted: number;
|
|
259
|
-
acceptedAccuracy: number | null;
|
|
260
|
-
abstentionRate: number;
|
|
261
|
-
correctAbstentions: number;
|
|
262
|
-
failures: {
|
|
263
|
-
input: string;
|
|
264
|
-
expected: unknown;
|
|
265
|
-
actual: unknown;
|
|
266
|
-
}[];
|
|
267
|
-
} | null;
|
|
268
144
|
trainingMs: number;
|
|
269
145
|
notes: string;
|
|
270
146
|
};
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,wBAAsB,GAAG,CACvB,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,wBAAsB,GAAG,CACvB,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAYjD"}
|