@mailwoman/mtf 0.0.0-stage → 10.8.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.
Files changed (103) hide show
  1. package/README.md +221 -2
  2. package/THIRD_PARTY_NOTICES.md +31 -0
  3. package/crates/mtf-channels/tests/fixtures/README.md +13 -0
  4. package/crates/mtf-sampler/tests/fixtures/README.md +120 -0
  5. package/lib/code-units.ts +45 -0
  6. package/lib/index.ts +266 -0
  7. package/out/code-units.d.ts +24 -0
  8. package/out/code-units.d.ts.map +1 -0
  9. package/out/code-units.js +36 -0
  10. package/out/code-units.js.map +1 -0
  11. package/out/index.d.ts +128 -0
  12. package/out/index.d.ts.map +1 -0
  13. package/out/index.js +171 -0
  14. package/out/index.js.map +1 -0
  15. package/out/tools/build-wasm.run.d.ts +14 -0
  16. package/out/tools/build-wasm.run.d.ts.map +1 -0
  17. package/out/tools/build-wasm.run.js +42 -0
  18. package/out/tools/build-wasm.run.js.map +1 -0
  19. package/out/tools/sampler/native.d.ts +314 -0
  20. package/out/tools/sampler/native.d.ts.map +1 -0
  21. package/out/tools/sampler/native.js +114 -0
  22. package/out/tools/sampler/native.js.map +1 -0
  23. package/out/tools/tokenizer/binary.d.ts +38 -0
  24. package/out/tools/tokenizer/binary.d.ts.map +1 -0
  25. package/out/tools/tokenizer/binary.js +94 -0
  26. package/out/tools/tokenizer/binary.js.map +1 -0
  27. package/out/tools/tokenizer/byte-fallback.d.ts +39 -0
  28. package/out/tools/tokenizer/byte-fallback.d.ts.map +1 -0
  29. package/out/tools/tokenizer/byte-fallback.js +49 -0
  30. package/out/tools/tokenizer/byte-fallback.js.map +1 -0
  31. package/out/tools/tokenizer/model.d.ts +70 -0
  32. package/out/tools/tokenizer/model.d.ts.map +1 -0
  33. package/out/tools/tokenizer/model.js +56 -0
  34. package/out/tools/tokenizer/model.js.map +1 -0
  35. package/out/tools/tokenizer/prune.d.ts +69 -0
  36. package/out/tools/tokenizer/prune.d.ts.map +1 -0
  37. package/out/tools/tokenizer/prune.js +126 -0
  38. package/out/tools/tokenizer/prune.js.map +1 -0
  39. package/out/tools/tokenizer/prune.run.d.ts +16 -0
  40. package/out/tools/tokenizer/prune.run.d.ts.map +1 -0
  41. package/out/tools/tokenizer/prune.run.js +34 -0
  42. package/out/tools/tokenizer/prune.run.js.map +1 -0
  43. package/out/tools/tokenizer/sentencepiece.d.ts +63 -0
  44. package/out/tools/tokenizer/sentencepiece.d.ts.map +1 -0
  45. package/out/tools/tokenizer/sentencepiece.js +90 -0
  46. package/out/tools/tokenizer/sentencepiece.js.map +1 -0
  47. package/out/tools/tokenizer/splice.d.ts +117 -0
  48. package/out/tools/tokenizer/splice.d.ts.map +1 -0
  49. package/out/tools/tokenizer/splice.js +398 -0
  50. package/out/tools/tokenizer/splice.js.map +1 -0
  51. package/out/tools/tokenizer/splice.run.d.ts +29 -0
  52. package/out/tools/tokenizer/splice.run.d.ts.map +1 -0
  53. package/out/tools/tokenizer/splice.run.js +114 -0
  54. package/out/tools/tokenizer/splice.run.js.map +1 -0
  55. package/out/tools/tokenizer/symbols.d.ts +42 -0
  56. package/out/tools/tokenizer/symbols.d.ts.map +1 -0
  57. package/out/tools/tokenizer/symbols.js +113 -0
  58. package/out/tools/tokenizer/symbols.js.map +1 -0
  59. package/out/tools/tokenizer/train/text.run.d.ts +16 -0
  60. package/out/tools/tokenizer/train/text.run.d.ts.map +1 -0
  61. package/out/tools/tokenizer/train/text.run.js +67 -0
  62. package/out/tools/tokenizer/train/text.run.js.map +1 -0
  63. package/out/tools/tokenizer/train.d.ts +113 -0
  64. package/out/tools/tokenizer/train.d.ts.map +1 -0
  65. package/out/tools/tokenizer/train.js +162 -0
  66. package/out/tools/tokenizer/train.js.map +1 -0
  67. package/out/tools/tokenizer/train.run.d.ts +24 -0
  68. package/out/tools/tokenizer/train.run.d.ts.map +1 -0
  69. package/out/tools/tokenizer/train.run.js +131 -0
  70. package/out/tools/tokenizer/train.run.js.map +1 -0
  71. package/out/tools/tokenizer/utilization.run.d.ts +17 -0
  72. package/out/tools/tokenizer/utilization.run.d.ts.map +1 -0
  73. package/out/tools/tokenizer/utilization.run.js +80 -0
  74. package/out/tools/tokenizer/utilization.run.js.map +1 -0
  75. package/out/tools/tokenizer/verify.d.ts +94 -0
  76. package/out/tools/tokenizer/verify.d.ts.map +1 -0
  77. package/out/tools/tokenizer/verify.js +193 -0
  78. package/out/tools/tokenizer/verify.js.map +1 -0
  79. package/out/tools/tokenizer/verify.run.d.ts +22 -0
  80. package/out/tools/tokenizer/verify.run.d.ts.map +1 -0
  81. package/out/tools/tokenizer/verify.run.js +71 -0
  82. package/out/tools/tokenizer/verify.run.js.map +1 -0
  83. package/package.json +107 -3
  84. package/third-party/darts-clone/LICENSE +10 -0
  85. package/third-party/sentencepiece/LICENSE +202 -0
  86. package/tools/build-wasm.run.ts +48 -0
  87. package/tools/sampler/native.ts +433 -0
  88. package/tools/tokenizer/binary.ts +118 -0
  89. package/tools/tokenizer/byte-fallback.ts +80 -0
  90. package/tools/tokenizer/model.ts +110 -0
  91. package/tools/tokenizer/prune.run.ts +37 -0
  92. package/tools/tokenizer/prune.ts +195 -0
  93. package/tools/tokenizer/sentencepiece.ts +142 -0
  94. package/tools/tokenizer/splice.run.ts +141 -0
  95. package/tools/tokenizer/splice.ts +592 -0
  96. package/tools/tokenizer/symbols.ts +119 -0
  97. package/tools/tokenizer/train/text.run.ts +80 -0
  98. package/tools/tokenizer/train.run.ts +151 -0
  99. package/tools/tokenizer/train.ts +266 -0
  100. package/tools/tokenizer/utilization.run.ts +96 -0
  101. package/tools/tokenizer/verify.run.ts +77 -0
  102. package/tools/tokenizer/verify.ts +313 -0
  103. package/wasm/mtf.wasm +0 -0
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * One SentencePiece training call, made with native `spm_train` and written in the Python wheel's model form.
7
+ *
8
+ * The flags are the keyword arguments a `SentencePieceTrainer.train(**flags)` call took, in the same order and with
9
+ * the same values. Two lists go through files rather than the command line, because the CLI splits an inline list
10
+ * on commas and a user-defined symbol may itself be a comma. `minloglevel` sets only the wheel's log level and has
11
+ * no CLI flag, so it is left off the command line.
12
+ *
13
+ * `spm_train` sets every trainer flag on its spec, so the model records defaults the caller did not supply.
14
+ * The wheel's spec holds only fields supplied in the call. After training, the rewrite drops trainer and normalizer
15
+ * fields absent from the flags. This produces the same bytes the wheel produces for that call.
16
+ */
17
+ import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
18
+ import { stringifyJSON } from "@mailwoman/core/json";
19
+ import { runFile } from "@mailwoman/core/process";
20
+ import { resolvePath } from "path-ts";
21
+ import { editModel } from "./model.js";
22
+ /**
23
+ * The list flags `spm_train` reads one entry per line from a file.
24
+ */
25
+ const FILE_LIST_FLAGS = {
26
+ user_defined_symbols: "user_defined_symbols_file",
27
+ control_symbols: "control_symbols_file",
28
+ };
29
+ /**
30
+ * The flags only the wheel reads.
31
+ */
32
+ const WHEEL_ONLY_FLAGS = new Set(["minloglevel"]);
33
+ /**
34
+ * This function serializes a list as one CSV row, matching the format Python's
35
+ * `csv.writer` produces for a list flag.
36
+ */
37
+ export function csvRow(values) {
38
+ return values
39
+ .map((value) => /[",\r\n]/.test(value) || (values.length === 1 && value === "") ? `"${value.replaceAll('"', '""')}"` : value)
40
+ .join(",");
41
+ }
42
+ /**
43
+ * A scalar flag as the wheel's `str(value)` renders it.
44
+ */
45
+ function scalar(value) {
46
+ if (typeof value === "boolean")
47
+ return value ? "true" : "false";
48
+ return String(value);
49
+ }
50
+ /**
51
+ * Train with `flags` containing `model_prefix`, then rewrite `<model_prefix>.model` in the wheel's form.
52
+ */
53
+ export async function trainSentencePiece(flags, options) {
54
+ const prefix = flags["model_prefix"];
55
+ if (typeof prefix !== "string")
56
+ throw new Error("a training call needs a model_prefix");
57
+ const argv = [];
58
+ for (const [name, value] of Object.entries(flags)) {
59
+ if (WHEEL_ONLY_FLAGS.has(name))
60
+ continue;
61
+ if (Array.isArray(value)) {
62
+ const listed = value;
63
+ const fileFlag = FILE_LIST_FLAGS[name];
64
+ if (fileFlag) {
65
+ if (!listed.length)
66
+ continue;
67
+ for (const entry of listed) {
68
+ if (/[\r\n]/.test(entry))
69
+ throw new Error(`${name} entry ${stringifyJSON(entry)} holds a line break`);
70
+ }
71
+ const file = `${options.workDirectory}/${fileFlag}.txt`;
72
+ await writeLocalTextFile(listed, file);
73
+ argv.push(`--${fileFlag}=${file}`);
74
+ }
75
+ else {
76
+ argv.push(`--${name}=${csvRow(listed)}`);
77
+ }
78
+ }
79
+ else {
80
+ argv.push(`--${name}=${scalar(value)}`);
81
+ }
82
+ }
83
+ const { stderr } = await runFile(options.spmTrain, argv, { maxBuffer: 1 << 30, cwd: options.cwd });
84
+ await writeLocalTextFile(stderr, `${options.workDirectory}/spm_train.log`);
85
+ const base = resolvePath(options.cwd ?? ".", prefix);
86
+ const model = `${base}.model`;
87
+ const { dropped_fields } = await editModel(model, model, { wheelFlags: Object.keys(flags) });
88
+ return { model, vocab: `${base}.vocab`, argv, dropped: dropped_fields };
89
+ }
90
+ //# sourceMappingURL=sentencepiece.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentencepiece.js","sourceRoot":"","sources":["../../../tools/tokenizer/sentencepiece.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAE,SAAS,EAAyB,MAAM,YAAY,CAAA;AAY7D;;GAEG;AACH,MAAM,eAAe,GAAqC;IACzD,oBAAoB,EAAE,2BAA2B;IACjD,eAAe,EAAE,sBAAsB;CACvC,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AAM,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAE5F,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,CAAA;AACxE,CAAC"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Splice the diacritic pieces of a locale tokenizer into a frozen unigram vocabulary, and grow an exported model's
7
+ * embedding table to match.
8
+ *
9
+ * An appended piece contains a code point outside ASCII, so it cannot match any span of an ASCII string, and ASCII
10
+ * text tokenizes exactly as before. `verifySourceIdentical` checks that on a probe rather than assuming it. A
11
+ * trained locale that shares a code point with the new pieces can re-tokenize. `checkCodepointOverlap`
12
+ * reports and refuses unless the locale is accepted. The method does not scale to CJK.
13
+ */
14
+ /**
15
+ * ASCII address lines, the default probe of the English-identity check.
16
+ */
17
+ export declare const ENGLISH_PROBE: readonly string[];
18
+ export interface SlavicCorpusOptions {
19
+ oaRoot: string;
20
+ locales: readonly string[];
21
+ outPath: string;
22
+ /**
23
+ * Rows read per OpenAddresses CSV.
24
+ *
25
+ * The read admits two rows past the cap, as the Python reader did.
26
+ */
27
+ perFileCap?: number;
28
+ /**
29
+ * Extra corpus lines, such as gazetteer alias names, appended after the sample.
30
+ */
31
+ extraText?: string | null;
32
+ /**
33
+ * The repetition count for the extra lines.
34
+ *
35
+ * A list of single names needs enough unigram mass to win vocabulary slots.
36
+ */
37
+ extraRepeat?: number;
38
+ }
39
+ /**
40
+ * The distinct `STREET`, `CITY` and `STREET CITY` lines of each locale's OpenAddresses CSVs,
41
+ * under 80 code points, shuffled and capped at 350,000, then the extra lines.
42
+ * Returns the number of lines written.
43
+ *
44
+ * The files of a locale are read in name order and the lines kept in first-seen order,
45
+ * so the corpus is the same on every run.
46
+ */
47
+ export declare function buildSlavicCorpus(options: SlavicCorpusOptions): Promise<number>;
48
+ /**
49
+ * Train the locale unigram model the splice draws its pieces from, and return its `.model` path.
50
+ */
51
+ export declare function trainDiacriticSentencePiece(corpusPath: string, outPrefix: string, options: {
52
+ spmTrain: string;
53
+ vocabSize?: number;
54
+ }): Promise<string>;
55
+ /**
56
+ * Raise when `probe` tokenizes differently under the spliced vocabulary than under the base one.
57
+ */
58
+ export declare function verifySourceIdentical(baseTokenizer: string, splicedTokenizer: string, probe?: readonly string[]): Promise<void>;
59
+ /**
60
+ * Append the pieces of `donor` whose core holds a code point outside ASCII and that `base`
61
+ * lacks, with their scores, as normal pieces, then check the English identity.
62
+ * Returns the appended pieces.
63
+ */
64
+ export declare function spliceVocabulary(base: string, donor: string, out: string): Promise<string[]>;
65
+ /**
66
+ * The code points outside ASCII in the first `capBytes` of a locale sample,
67
+ * read as UTF-8 with undecodable bytes ignored.
68
+ * A character split by the byte cap is left out.
69
+ *
70
+ * The sample is read as raw text rather than parsed, because the check needs a locale's
71
+ * character inventory and not its records, and any sample format then works.
72
+ */
73
+ export declare function collectSampleCodepoints(samplePath: string, capBytes?: number): Promise<Set<string>>;
74
+ export interface OverlapReport {
75
+ new_piece_codepoints: string[];
76
+ per_locale_overlap: Record<string, string[]>;
77
+ accepted_overlap: string[];
78
+ }
79
+ /**
80
+ * Report the code points outside ASCII that the new pieces share with each trained locale's
81
+ * sample, write the report, and raise when an overlapping locale is not in `acceptedOverlap`.
82
+ *
83
+ * The evaluation for an accepted locale must meet a registered per-locale non-inferiority
84
+ * comparison for it before the first measurement.
85
+ */
86
+ export declare function checkCodepointOverlap(newPieces: readonly string[], localeSamples: Readonly<Record<string, string>>, reportPath: string, acceptedOverlap?: ReadonlySet<string>): Promise<Record<string, string[]>>;
87
+ /**
88
+ * Refuses a table initializer whose dims or byte length differ from `[rows, columns]` at `bytesPerValue`.
89
+ *
90
+ * @throws Naming the initializer, its dims and byte length, and the shape it was expected to have.
91
+ */
92
+ export declare function assertTableShape(label: string, tensor: {
93
+ dims: readonly number[];
94
+ bytes: Uint8Array;
95
+ }, [rows, columns]: readonly [number, number], bytesPerValue: number): void;
96
+ export interface ONNXMeanInitOptions {
97
+ fp32ONNX: string;
98
+ baseTokenizer: string;
99
+ splicedTokenizer: string;
100
+ outFp32: string;
101
+ int8ONNX?: string | null;
102
+ outInt8?: string | null;
103
+ embeddingName?: string;
104
+ }
105
+ /**
106
+ * Grow an exported model's token embedding table to the spliced vocabulary.
107
+ *
108
+ * Each new row is the mean of the base tokenizer's pieces for the new piece's surface (FVT),
109
+ * or the mean of every row when the surface has no piece inside the old vocabulary.
110
+ * The embedding is the only vocabulary-sized tensor of the token classifier,
111
+ * so the rest of the graph is unchanged.
112
+ *
113
+ * For an int8 twin the new rows are quantized with the table's own scale and zero point,
114
+ * after checking that those parameters reproduce the table's last row.
115
+ */
116
+ export declare function meanInitONNXEmbeddings(options: ONNXMeanInitOptions): Promise<[number, number]>;
117
+ //# sourceMappingURL=splice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splice.d.ts","sourceRoot":"","sources":["../../../tools/tokenizer/splice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsBH;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAA;AAiCD,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgErF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AAE,SAAS,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,EACtD,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,aAAa,EAAE,MAAM,GACnB,IAAI,CAcN;AAwFD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA0GpG"}
@@ -0,0 +1,398 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Splice the diacritic pieces of a locale tokenizer into a frozen unigram vocabulary, and grow an exported model's
7
+ * embedding table to match.
8
+ *
9
+ * An appended piece contains a code point outside ASCII, so it cannot match any span of an ASCII string, and ASCII
10
+ * text tokenizes exactly as before. `verifySourceIdentical` checks that on a probe rather than assuming it. A
11
+ * trained locale that shares a code point with the new pieces can re-tokenize. `checkCodepointOverlap`
12
+ * reports and refuses unless the locale is accepted. The method does not scale to CJK.
13
+ */
14
+ import { readFileRange, readLocalBuffer, readLocalJSONFile, readLocalTextFile } from "@mailwoman/core/fs/readers";
15
+ import { isDirectory, isFile } from "@mailwoman/core/fs/readers/stat";
16
+ import { temporaryDirectory } from "@mailwoman/core/fs/temporary";
17
+ import { makeDirectories, writeLocalBuffer, writeLocalJSONFile, writeLocalTextFile } from "@mailwoman/core/fs/writers";
18
+ import { prettyJSON, stringifyJSON } from "@mailwoman/core/json";
19
+ import { codePointLength } from "@mailwoman/core/strings/code-points";
20
+ import { splitLines } from "@mailwoman/core/strings/unicode";
21
+ import { CSVSpliterator } from "spliterator";
22
+ import { Globerator } from "spliterator/node/fs";
23
+ import { runMTFTokenizer } from "./binary.js";
24
+ import { editModel, loadEncoder, PieceType, readModelPieces } from "./model.js";
25
+ import { trainSentencePiece } from "./sentencepiece.js";
26
+ /**
27
+ * The corpus sample size and the seed of its shuffle.
28
+ */
29
+ const CORPUS_SAMPLE = 350_000;
30
+ const CORPUS_SEED = 42;
31
+ /**
32
+ * ASCII address lines, the default probe of the English-identity check.
33
+ */
34
+ export const ENGLISH_PROBE = [
35
+ "109 Seminary Dr, Mill Valley, CA 94941",
36
+ "5210 South Ingleside Avenue, Chicago, IL 60615",
37
+ "1600 Pennsylvania Ave NW, Washington, DC 20500",
38
+ "350 Fifth Avenue, New York, NY 10118",
39
+ "1 Infinite Loop, Cupertino, CA 95014",
40
+ ];
41
+ /**
42
+ * The piece text without SentencePiece's word-boundary marker.
43
+ */
44
+ function core(piece) {
45
+ return piece.replaceAll("▁", "");
46
+ }
47
+ /**
48
+ * The first code point outside ASCII.
49
+ */
50
+ const NON_ASCII = 0x80;
51
+ /**
52
+ * Corpus lines this long or longer, in code points, are left out: they are run-on records rather than names.
53
+ */
54
+ const MAX_LINE_CODE_POINTS = 80;
55
+ /**
56
+ * The int8 check accepts at most one mismatched value for each configured group
57
+ * of values in the reconstructed row.
58
+ */
59
+ const QUANTIZE_MISMATCH_DIVISOR = 20;
60
+ function isNonASCII(c) {
61
+ return c.codePointAt(0) >= NON_ASCII;
62
+ }
63
+ function isASCII(text) {
64
+ return ![...text].some(isNonASCII);
65
+ }
66
+ /**
67
+ * The distinct `STREET`, `CITY` and `STREET CITY` lines of each locale's OpenAddresses CSVs,
68
+ * under 80 code points, shuffled and capped at 350,000, then the extra lines.
69
+ * Returns the number of lines written.
70
+ *
71
+ * The files of a locale are read in name order and the lines kept in first-seen order,
72
+ * so the corpus is the same on every run.
73
+ */
74
+ export async function buildSlavicCorpus(options) {
75
+ const perFileCap = options.perFileCap ?? 400_000;
76
+ const lines = new Set();
77
+ for (const locale of options.locales) {
78
+ const directory = `${options.oaRoot}/${locale}`;
79
+ if (!(await isDirectory(directory)))
80
+ continue;
81
+ const names = await Globerator.from("*.csv", { cwd: directory, absolute: false }).toSorted();
82
+ for (const name of names) {
83
+ try {
84
+ const rows = CSVSpliterator.fromAsync(`${directory}/${name}`, {
85
+ normalizeKeys: false,
86
+ take: perFileCap + 2,
87
+ });
88
+ for await (const row of rows) {
89
+ const street = row["STREET"] || "";
90
+ const city = row["CITY"] || "";
91
+ if (street) {
92
+ lines.add(street);
93
+ }
94
+ if (city) {
95
+ lines.add(city);
96
+ }
97
+ if (street && city) {
98
+ lines.add(`${street} ${city}`);
99
+ }
100
+ }
101
+ }
102
+ catch (error) {
103
+ console.warn(`skipped the rest of ${directory}/${name}: ${error.message}`);
104
+ }
105
+ }
106
+ }
107
+ await using scratch = await temporaryDirectory("mtf-slavic-");
108
+ const unshuffled = scratch.path("lines.json").toString();
109
+ const shuffled = scratch.path("shuffled.json").toString();
110
+ await writeLocalJSONFile([...lines].filter((line) => line && codePointLength(line) < MAX_LINE_CODE_POINTS), unshuffled);
111
+ await runMTFTokenizer(["shuffle", "--seed", String(CORPUS_SEED), "--input", unshuffled, "--out", shuffled]);
112
+ const corpus = (await readLocalJSONFile(shuffled)).slice(0, CORPUS_SAMPLE);
113
+ if (options.extraText && (await isFile(options.extraText))) {
114
+ const extra = splitLines(await readLocalTextFile(options.extraText))
115
+ .map((line) => line.trim())
116
+ .filter((line) => line && codePointLength(line) < MAX_LINE_CODE_POINTS);
117
+ for (let i = 0; i < Math.max(1, options.extraRepeat ?? 10); i++) {
118
+ corpus.push(...extra);
119
+ }
120
+ }
121
+ await writeLocalTextFile(corpus.join("\n"), options.outPath);
122
+ return corpus.length;
123
+ }
124
+ /**
125
+ * Train the locale unigram model the splice draws its pieces from, and return its `.model` path.
126
+ */
127
+ export async function trainDiacriticSentencePiece(corpusPath, outPrefix, options) {
128
+ await using scratch = await temporaryDirectory("mtf-diacritic-");
129
+ const trained = await trainSentencePiece({
130
+ input: corpusPath,
131
+ model_prefix: outPrefix,
132
+ vocab_size: options.vocabSize ?? 24_000,
133
+ model_type: "unigram",
134
+ character_coverage: 1,
135
+ normalization_rule_name: "identity",
136
+ num_threads: 8,
137
+ }, { spmTrain: options.spmTrain, workDirectory: scratch.path.toString() });
138
+ return trained.model;
139
+ }
140
+ /**
141
+ * Raise when `probe` tokenizes differently under the spliced vocabulary than under the base one.
142
+ */
143
+ export async function verifySourceIdentical(baseTokenizer, splicedTokenizer, probe = ENGLISH_PROBE) {
144
+ using base = await loadEncoder(baseTokenizer);
145
+ using spliced = await loadEncoder(splicedTokenizer);
146
+ const differing = probe.filter((text) => base.encode(text).pieces.join("\0") !== spliced.encode(text).pieces.join("\0"));
147
+ if (differing.length) {
148
+ throw new Error(`source tokenization changed on ${differing.length}/${probe.length} probe strings: a piece containing ASCII ` +
149
+ `was spliced in. First: ${stringifyJSON(differing[0])}`);
150
+ }
151
+ }
152
+ /**
153
+ * Append the pieces of `donor` whose core holds a code point outside ASCII and that `base`
154
+ * lacks, with their scores, as normal pieces, then check the English identity.
155
+ * Returns the appended pieces.
156
+ */
157
+ export async function spliceVocabulary(base, donor, out) {
158
+ const basePieces = new Set((await readModelPieces(base)).map(([piece]) => piece));
159
+ const appended = (await readModelPieces(donor))
160
+ .filter(([piece]) => {
161
+ const text = core(piece);
162
+ return text && !isASCII(text) && !basePieces.has(piece);
163
+ })
164
+ .map(([piece, score]) => [piece, score, PieceType.Normal]);
165
+ await makeDirectories(out.slice(0, out.lastIndexOf("/")) || ".");
166
+ await editModel(base, out, { append: appended });
167
+ await verifySourceIdentical(base, out);
168
+ return appended.map(([piece]) => piece);
169
+ }
170
+ function byCodePoint(a, b) {
171
+ return a.codePointAt(0) - b.codePointAt(0);
172
+ }
173
+ const REPLACEMENT_CHARACTER = "�";
174
+ /**
175
+ * The code points outside ASCII in the first `capBytes` of a locale sample,
176
+ * read as UTF-8 with undecodable bytes ignored.
177
+ * A character split by the byte cap is left out.
178
+ *
179
+ * The sample is read as raw text rather than parsed, because the check needs a locale's
180
+ * character inventory and not its records, and any sample format then works.
181
+ */
182
+ export async function collectSampleCodepoints(samplePath, capBytes = 4_000_000) {
183
+ const bytes = await readFileRange(samplePath, 0, capBytes);
184
+ // A streaming decode holds back an incomplete final sequence instead of replacing it.
185
+ const text = new TextDecoder("utf-8").decode(bytes, { stream: true });
186
+ const out = new Set();
187
+ for (const c of text) {
188
+ if (isNonASCII(c)) {
189
+ out.add(c);
190
+ }
191
+ }
192
+ // The decoder replaces an invalid byte with U+FFFD, where Python's `errors="ignore"` drops it.
193
+ if (!bytes.includes(Buffer.from(REPLACEMENT_CHARACTER))) {
194
+ out.delete(REPLACEMENT_CHARACTER);
195
+ }
196
+ return out;
197
+ }
198
+ /**
199
+ * Report the code points outside ASCII that the new pieces share with each trained locale's
200
+ * sample, write the report, and raise when an overlapping locale is not in `acceptedOverlap`.
201
+ *
202
+ * The evaluation for an accepted locale must meet a registered per-locale non-inferiority
203
+ * comparison for it before the first measurement.
204
+ */
205
+ export async function checkCodepointOverlap(newPieces, localeSamples, reportPath, acceptedOverlap = new Set()) {
206
+ const newCodepoints = new Set();
207
+ for (const piece of newPieces) {
208
+ for (const c of core(piece)) {
209
+ if (isNonASCII(c)) {
210
+ newCodepoints.add(c);
211
+ }
212
+ }
213
+ }
214
+ const report = {};
215
+ for (const locale of Object.keys(localeSamples).toSorted()) {
216
+ const sample = await collectSampleCodepoints(localeSamples[locale]);
217
+ report[locale] = [...newCodepoints].filter((c) => sample.has(c)).toSorted(byCodePoint);
218
+ }
219
+ const written = {
220
+ new_piece_codepoints: [...newCodepoints].toSorted(byCodePoint),
221
+ per_locale_overlap: report,
222
+ accepted_overlap: [...acceptedOverlap].toSorted(),
223
+ };
224
+ await writeLocalTextFile(prettyJSON(written, true, 2), reportPath);
225
+ const offending = Object.entries(report)
226
+ .filter(([locale, codepoints]) => codepoints.length > 0 && !acceptedOverlap.has(locale))
227
+ .map(([locale]) => locale);
228
+ if (offending.length) {
229
+ const detail = offending.map((locale) => `${locale}: ${report[locale].slice(0, 12).join("")}`).join("; ");
230
+ throw new Error(`splice check: code point overlap with trained locale(s) ${offending.join(", ")} (${detail}). Either the ` +
231
+ `overlap is a defect, or register a per-locale non-inferiority comparison for each and pass ` +
232
+ `--accept-overlap ${offending.join(",")}. Report: ${reportPath}`);
233
+ }
234
+ return report;
235
+ }
236
+ /**
237
+ * The ONNX element type codes this module reads.
238
+ */
239
+ const ONNX_FLOAT = 1;
240
+ const ONNX_UINT8 = 2;
241
+ /**
242
+ * Refuses a table initializer whose dims or byte length differ from `[rows, columns]` at `bytesPerValue`.
243
+ *
244
+ * @throws Naming the initializer, its dims and byte length, and the shape it was expected to have.
245
+ */
246
+ export function assertTableShape(label, tensor, [rows, columns], bytesPerValue) {
247
+ const expectedBytes = rows * columns * bytesPerValue;
248
+ if (tensor.dims.length !== 2 ||
249
+ tensor.dims[0] !== rows ||
250
+ tensor.dims[1] !== columns ||
251
+ tensor.bytes.length !== expectedBytes) {
252
+ throw new Error(`${label} has dims [${tensor.dims.join(", ")}] and ${tensor.bytes.length} bytes; ` +
253
+ `expected [${rows}, ${columns}] in ${expectedBytes} bytes`);
254
+ }
255
+ }
256
+ async function readInitializer(model, name, directory) {
257
+ const raw = `${directory}/${name.replaceAll("/", "_")}.bin`;
258
+ const meta = await runMTFTokenizer([
259
+ "onnx-read",
260
+ "--model",
261
+ model,
262
+ "--name",
263
+ name,
264
+ "--raw-out",
265
+ raw,
266
+ ]);
267
+ return { ...meta, bytes: await readLocalBuffer(raw) };
268
+ }
269
+ async function writeInitializer(model, out, name, tensor, directory) {
270
+ const raw = `${directory}/${name.replaceAll("/", "_")}.out.bin`;
271
+ await writeLocalBuffer(tensor.bytes, raw);
272
+ await makeDirectories(out.slice(0, out.lastIndexOf("/")) || ".");
273
+ await runMTFTokenizer([
274
+ "onnx-write",
275
+ "--model",
276
+ model,
277
+ "--name",
278
+ name,
279
+ "--dims",
280
+ tensor.dims.join(","),
281
+ "--data-type",
282
+ String(tensor.data_type),
283
+ "--raw",
284
+ raw,
285
+ "--out",
286
+ out,
287
+ ]);
288
+ }
289
+ /**
290
+ * The mean, in `float32`, of the rows of `table` at `rows`: each column summed row
291
+ * by row in `float32`, then divided by the row count.
292
+ * NumPy reduces `table[rows].mean(0)` the same way.
293
+ */
294
+ function meanRow(table, hidden, rows) {
295
+ const out = new Float32Array(hidden);
296
+ for (let j = 0; j < hidden; j++) {
297
+ let sum = table[rows[0] * hidden + j];
298
+ for (let r = 1; r < rows.length; r++) {
299
+ sum = Math.fround(sum + table[rows[r] * hidden + j]);
300
+ }
301
+ out[j] = Math.fround(sum / rows.length);
302
+ }
303
+ return out;
304
+ }
305
+ /**
306
+ * NumPy's `np.round` for one value: to the nearest integer, ties to even.
307
+ */
308
+ function roundHalfEven(value) {
309
+ const floor = Math.floor(value);
310
+ const fraction = value - floor;
311
+ if (fraction > 0.5)
312
+ return floor + 1;
313
+ if (fraction < 0.5)
314
+ return floor;
315
+ return floor % 2 === 0 ? floor : floor + 1;
316
+ }
317
+ function quantize(value, scale, zeroPoint) {
318
+ const scaled = Math.fround(value / scale);
319
+ return Math.min(255, Math.max(0, Math.fround(roundHalfEven(scaled) + zeroPoint)));
320
+ }
321
+ /**
322
+ * Grow an exported model's token embedding table to the spliced vocabulary.
323
+ *
324
+ * Each new row is the mean of the base tokenizer's pieces for the new piece's surface (FVT),
325
+ * or the mean of every row when the surface has no piece inside the old vocabulary.
326
+ * The embedding is the only vocabulary-sized tensor of the token classifier,
327
+ * so the rest of the graph is unchanged.
328
+ *
329
+ * For an int8 twin the new rows are quantized with the table's own scale and zero point,
330
+ * after checking that those parameters reproduce the table's last row.
331
+ */
332
+ export async function meanInitONNXEmbeddings(options) {
333
+ const name = options.embeddingName ?? "inner.token_embeddings.weight";
334
+ await using scratch = await temporaryDirectory("mtf-mean-init-");
335
+ const directory = scratch.path.toString();
336
+ const embedding = await readInitializer(options.fp32ONNX, name, directory);
337
+ if (embedding.data_type !== ONNX_FLOAT || embedding.dims.length !== 2) {
338
+ throw new Error(`${name} in ${options.fp32ONNX} is not a float32 matrix`);
339
+ }
340
+ const [oldVocab, hidden] = embedding.dims;
341
+ // A short `raw_data` would read as a table of zeros past its end, and every spliced row would average them in.
342
+ assertTableShape(`${name} in ${options.fp32ONNX}`, embedding, [oldVocab, hidden], Float32Array.BYTES_PER_ELEMENT);
343
+ // A copy, because a `Float32Array` view needs a 4-byte-aligned offset that a read buffer need not have.
344
+ const table = new Float32Array(new Uint8Array(embedding.bytes).buffer, 0, oldVocab * hidden);
345
+ const spliced = await readModelPieces(options.splicedTokenizer);
346
+ const newVocab = spliced.length;
347
+ if (newVocab < oldVocab) {
348
+ throw new Error(`spliced vocab ${newVocab} < embedding vocab ${oldVocab}: wrong tokenizer?`);
349
+ }
350
+ const globalMean = meanRow(table, hidden, Array.from({ length: oldVocab }, (_, i) => i));
351
+ const newRows = new Float32Array((newVocab - oldVocab) * hidden);
352
+ {
353
+ using base = await loadEncoder(options.baseTokenizer);
354
+ for (let id = oldVocab; id < newVocab; id++) {
355
+ const surface = spliced[id][0].replaceAll("▁", " ");
356
+ const constituents = base.encode(surface).ids.filter((i) => i < oldVocab);
357
+ newRows.set(constituents.length ? meanRow(table, hidden, constituents) : globalMean, (id - oldVocab) * hidden);
358
+ }
359
+ }
360
+ const grown = new Float32Array(newVocab * hidden);
361
+ grown.set(table);
362
+ grown.set(newRows, oldVocab * hidden);
363
+ await writeInitializer(options.fp32ONNX, options.outFp32, name, { dims: [newVocab, hidden], data_type: ONNX_FLOAT, bytes: new Uint8Array(grown.buffer) }, directory);
364
+ if (options.int8ONNX && options.outInt8) {
365
+ const quantized = await readInitializer(options.int8ONNX, `${name}_quantized`, directory);
366
+ const scaleTensor = await readInitializer(options.int8ONNX, `${name}_scale`, directory);
367
+ const zeroTensor = await readInitializer(options.int8ONNX, `${name}_zero_point`, directory);
368
+ if (quantized.data_type !== ONNX_UINT8)
369
+ throw new Error(`${name}_quantized is not a uint8 table`);
370
+ // The int8 table must describe the same vocabulary and width as the fp32 one, or the grown table mixes rows.
371
+ assertTableShape(`${name}_quantized in ${options.int8ONNX}`, quantized, [oldVocab, hidden], 1);
372
+ if (scaleTensor.bytes.length < Float32Array.BYTES_PER_ELEMENT || !zeroTensor.bytes.length) {
373
+ throw new Error(`${name}_scale or ${name}_zero_point in ${options.int8ONNX} holds no value`);
374
+ }
375
+ const scale = scaleTensor.bytes.readFloatLE(0);
376
+ const zeroPoint = zeroTensor.bytes[0];
377
+ const lastRow = oldVocab - 1;
378
+ let mismatched = 0;
379
+ for (let j = 0; j < hidden; j++) {
380
+ if (quantize(table[lastRow * hidden + j], scale, zeroPoint) !== quantized.bytes[lastRow * hidden + j]) {
381
+ mismatched++;
382
+ }
383
+ }
384
+ // Up to one value in twenty may sit on the other side of a rounding boundary.
385
+ // More means the wrong scale or zero point.
386
+ if (mismatched > Math.floor(hidden / QUANTIZE_MISMATCH_DIVISOR)) {
387
+ throw new Error(`int8 inverse mismatch on row ${lastRow}: ${mismatched}/${hidden}; scale or zero point wrong?`);
388
+ }
389
+ const grownQuantized = new Uint8Array(newVocab * hidden);
390
+ grownQuantized.set(quantized.bytes.subarray(0, oldVocab * hidden));
391
+ for (let i = 0; i < newRows.length; i++) {
392
+ grownQuantized[oldVocab * hidden + i] = quantize(newRows[i], scale, zeroPoint);
393
+ }
394
+ await writeInitializer(options.int8ONNX, options.outInt8, `${name}_quantized`, { dims: [newVocab, hidden], data_type: quantized.data_type, bytes: grownQuantized }, directory);
395
+ }
396
+ return [oldVocab, newVocab];
397
+ }
398
+ //# sourceMappingURL=splice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splice.js","sourceRoot":"","sources":["../../../tools/tokenizer/splice.ts"],"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