@mailwoman/mtf 10.7.0 → 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 (92) hide show
  1. package/README.md +35 -5
  2. package/crates/mtf-channels/tests/fixtures/README.md +13 -0
  3. package/crates/mtf-sampler/tests/fixtures/README.md +120 -0
  4. package/lib/code-units.ts +45 -0
  5. package/out/code-units.d.ts +24 -0
  6. package/out/code-units.d.ts.map +1 -0
  7. package/out/code-units.js +36 -0
  8. package/out/code-units.js.map +1 -0
  9. package/out/tools/build-wasm.run.js +2 -2
  10. package/out/tools/build-wasm.run.js.map +1 -1
  11. package/out/tools/sampler/native.d.ts +314 -0
  12. package/out/tools/sampler/native.d.ts.map +1 -0
  13. package/out/tools/sampler/native.js +114 -0
  14. package/out/tools/sampler/native.js.map +1 -0
  15. package/out/tools/tokenizer/binary.d.ts +38 -0
  16. package/out/tools/tokenizer/binary.d.ts.map +1 -0
  17. package/out/tools/tokenizer/binary.js +94 -0
  18. package/out/tools/tokenizer/binary.js.map +1 -0
  19. package/out/tools/tokenizer/byte-fallback.d.ts +39 -0
  20. package/out/tools/tokenizer/byte-fallback.d.ts.map +1 -0
  21. package/out/tools/tokenizer/byte-fallback.js +49 -0
  22. package/out/tools/tokenizer/byte-fallback.js.map +1 -0
  23. package/out/tools/tokenizer/model.d.ts +70 -0
  24. package/out/tools/tokenizer/model.d.ts.map +1 -0
  25. package/out/tools/tokenizer/model.js +56 -0
  26. package/out/tools/tokenizer/model.js.map +1 -0
  27. package/out/tools/tokenizer/prune.d.ts +69 -0
  28. package/out/tools/tokenizer/prune.d.ts.map +1 -0
  29. package/out/tools/tokenizer/prune.js +126 -0
  30. package/out/tools/tokenizer/prune.js.map +1 -0
  31. package/out/tools/tokenizer/prune.run.d.ts +16 -0
  32. package/out/tools/tokenizer/prune.run.d.ts.map +1 -0
  33. package/out/tools/tokenizer/prune.run.js +34 -0
  34. package/out/tools/tokenizer/prune.run.js.map +1 -0
  35. package/out/tools/tokenizer/sentencepiece.d.ts +63 -0
  36. package/out/tools/tokenizer/sentencepiece.d.ts.map +1 -0
  37. package/out/tools/tokenizer/sentencepiece.js +90 -0
  38. package/out/tools/tokenizer/sentencepiece.js.map +1 -0
  39. package/out/tools/tokenizer/splice.d.ts +117 -0
  40. package/out/tools/tokenizer/splice.d.ts.map +1 -0
  41. package/out/tools/tokenizer/splice.js +398 -0
  42. package/out/tools/tokenizer/splice.js.map +1 -0
  43. package/out/tools/tokenizer/splice.run.d.ts +29 -0
  44. package/out/tools/tokenizer/splice.run.d.ts.map +1 -0
  45. package/out/tools/tokenizer/splice.run.js +114 -0
  46. package/out/tools/tokenizer/splice.run.js.map +1 -0
  47. package/out/tools/tokenizer/symbols.d.ts +42 -0
  48. package/out/tools/tokenizer/symbols.d.ts.map +1 -0
  49. package/out/tools/tokenizer/symbols.js +113 -0
  50. package/out/tools/tokenizer/symbols.js.map +1 -0
  51. package/out/tools/tokenizer/train/text.run.d.ts +16 -0
  52. package/out/tools/tokenizer/train/text.run.d.ts.map +1 -0
  53. package/out/tools/tokenizer/train/text.run.js +67 -0
  54. package/out/tools/tokenizer/train/text.run.js.map +1 -0
  55. package/out/tools/tokenizer/train.d.ts +113 -0
  56. package/out/tools/tokenizer/train.d.ts.map +1 -0
  57. package/out/tools/tokenizer/train.js +162 -0
  58. package/out/tools/tokenizer/train.js.map +1 -0
  59. package/out/tools/tokenizer/train.run.d.ts +24 -0
  60. package/out/tools/tokenizer/train.run.d.ts.map +1 -0
  61. package/out/tools/tokenizer/train.run.js +131 -0
  62. package/out/tools/tokenizer/train.run.js.map +1 -0
  63. package/out/tools/tokenizer/utilization.run.d.ts +17 -0
  64. package/out/tools/tokenizer/utilization.run.d.ts.map +1 -0
  65. package/out/tools/tokenizer/utilization.run.js +80 -0
  66. package/out/tools/tokenizer/utilization.run.js.map +1 -0
  67. package/out/tools/tokenizer/verify.d.ts +94 -0
  68. package/out/tools/tokenizer/verify.d.ts.map +1 -0
  69. package/out/tools/tokenizer/verify.js +193 -0
  70. package/out/tools/tokenizer/verify.js.map +1 -0
  71. package/out/tools/tokenizer/verify.run.d.ts +22 -0
  72. package/out/tools/tokenizer/verify.run.d.ts.map +1 -0
  73. package/out/tools/tokenizer/verify.run.js +71 -0
  74. package/out/tools/tokenizer/verify.run.js.map +1 -0
  75. package/package.json +15 -3
  76. package/tools/build-wasm.run.ts +2 -2
  77. package/tools/sampler/native.ts +433 -0
  78. package/tools/tokenizer/binary.ts +118 -0
  79. package/tools/tokenizer/byte-fallback.ts +80 -0
  80. package/tools/tokenizer/model.ts +110 -0
  81. package/tools/tokenizer/prune.run.ts +37 -0
  82. package/tools/tokenizer/prune.ts +195 -0
  83. package/tools/tokenizer/sentencepiece.ts +142 -0
  84. package/tools/tokenizer/splice.run.ts +141 -0
  85. package/tools/tokenizer/splice.ts +592 -0
  86. package/tools/tokenizer/symbols.ts +119 -0
  87. package/tools/tokenizer/train/text.run.ts +80 -0
  88. package/tools/tokenizer/train.run.ts +151 -0
  89. package/tools/tokenizer/train.ts +266 -0
  90. package/tools/tokenizer/utilization.run.ts +96 -0
  91. package/tools/tokenizer/verify.run.ts +77 -0
  92. package/tools/tokenizer/verify.ts +313 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../tools/sampler/native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,MA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c,CAAC,CAAA;IAC1C,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAAA;IAC9D,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAAA;IACjE,eAAe,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;IAChD,mBAAmB,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;IACxD,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;CACtB;AAED;;GAEG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CA8ChD"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The `mtf-node` addon: the training-row sampler and the row encoders of `crates/mtf-node`, loaded into Node.
7
+ *
8
+ * Cargo builds the addon from source the first time a process asks for it, under the root workspace's `node`
9
+ * profile and the toolchain the root `rust-toolchain.toml` pins, into the root `target/node/`. The build
10
+ * reads `mtf-sampler` with its parquet reader, so it stays out of the browser `wasm/mtf.wasm`, whose one dependency is
11
+ * `mtf-core`. The addon is built for the host it runs on: Linux and macOS, where Cargo writes the library to
12
+ * `libmtf_node.so` and `libmtf_node.dylib`.
13
+ */
14
+ import { repoRootPath, workspacePath } from "@mailwoman/core/paths";
15
+ import { runFile } from "@mailwoman/core/process";
16
+ import { platformName as platform } from "@mailwoman/core/utils/system";
17
+ /**
18
+ * The kinds of event the sampler reports.
19
+ */
20
+ export const SamplerEventKind = {
21
+ RowEmitted: "row_emitted",
22
+ RowSkipped: "row_skipped",
23
+ SourceRestarted: "source_restarted",
24
+ EpochComplete: "epoch_complete",
25
+ };
26
+ /**
27
+ * The file Cargo writes the addon to on each platform the addon builds for.
28
+ */
29
+ const LIBRARY_NAMES = {
30
+ linux: "libmtf_node.so",
31
+ darwin: "libmtf_node.dylib",
32
+ };
33
+ /**
34
+ * Cargo's output for one build can run long, so the buffer is far above Node's 1 MB default.
35
+ */
36
+ const OUTPUT_LIMIT = 1 << 30;
37
+ let addon = null;
38
+ /**
39
+ * The path of a current `mtf-node` build, building it first.
40
+ *
41
+ * Cargo rebuilds only when a crate source, a manifest or the lockfile changed,
42
+ * so a current build costs a second.
43
+ */
44
+ export async function buildMTFNode() {
45
+ const name = LIBRARY_NAMES[platform()];
46
+ if (!name) {
47
+ throw new Error(`mtf-node builds on Linux and macOS; this host is ${platform()}`);
48
+ }
49
+ await runFile("cargo", ["build", "--profile", "node", "--locked", "-p", "mtf-node"], {
50
+ cwd: workspacePath("mtf"),
51
+ maxBuffer: OUTPUT_LIMIT,
52
+ });
53
+ return repoRootPath("target", "node", name);
54
+ }
55
+ /**
56
+ * The loaded addon, built the first time a process asks.
57
+ */
58
+ export function loadMTFNode() {
59
+ addon ??= (async () => {
60
+ const path = await buildMTFNode();
61
+ const module = { exports: {} };
62
+ // `require` loads an addon only from a `.node` file, and Cargo gives the library the
63
+ // platform's extension, so the addon is opened the way `require` opens one.
64
+ process.dlopen(module, path);
65
+ return module.exports;
66
+ })();
67
+ return addon;
68
+ }
69
+ /**
70
+ * The addon, with the encoders' outputs renamed to the repository's acronym spelling.
71
+ */
72
+ export async function mtfNode() {
73
+ const native = await loadMTFNode();
74
+ return {
75
+ Sampler: native.Sampler,
76
+ TrainingBatches: native.TrainingBatches,
77
+ RawRows: native.RawRows,
78
+ SplitColumns: native.SplitColumns,
79
+ createRowEncoder(options) {
80
+ const { padID, ...rest } = options;
81
+ // napi-rs reads an `Option` from `undefined` and refuses `null`, which an unset config path holds.
82
+ const present = Object.fromEntries(Object.entries(rest).filter(([, value]) => value != null));
83
+ const encoder = new native.RowEncoder({ ...present, padId: padID });
84
+ return {
85
+ get channelDims() {
86
+ return encoder.channelDims;
87
+ },
88
+ encodeBatch(rows) {
89
+ const { inputIds, ...batch } = encoder.encodeBatch(rows);
90
+ return { ...batch, inputIDs: inputIds };
91
+ },
92
+ };
93
+ },
94
+ createCharEncoder(options) {
95
+ const encoder = new native.CharEncoder(options);
96
+ return {
97
+ encodeBatch(rows) {
98
+ const { charIds, ...batch } = encoder.encodeBatch(rows);
99
+ return { ...batch, charIDs: charIds };
100
+ },
101
+ };
102
+ },
103
+ sourceRowCounts: native.sourceRowCounts,
104
+ deriveSourceWeights: native.deriveSourceWeights,
105
+ channelNames: native.channelNames,
106
+ pythonText: {
107
+ casefold: native.pythonCasefold,
108
+ scriptRuns: native.pythonScriptRuns,
109
+ detectScript: native.pythonDetectScript,
110
+ isLatinText: native.pythonIsLatinText,
111
+ },
112
+ };
113
+ }
114
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../../../tools/sampler/native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAiCvE;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;IACzB,eAAe,EAAE,kBAAkB;IACnC,aAAa,EAAE,gBAAgB;CACtB,CAAA;AAgQV;;GAEG;AACH,MAAM,aAAa,GAAoC;IACtD,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,mBAAmB;CAC3B,CAAA;AAED;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,CAAA;AAE5B,IAAI,KAAK,GAAiC,IAAI,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IACjC,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAA;IAEtC,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,MAA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native programs the tokenizer tools run: `mtf-tokenizer`, built from `crates/mtf-tools`, and
7
+ * SentencePiece v0.2.2's `spm_train`.
8
+ *
9
+ * `mtf-tokenizer` is a binary rather than a Node addon. Each tool calls it a handful of times over files, so a
10
+ * process per call costs milliseconds. A binary also builds without an addon toolchain, a per-platform artifact or ABI
11
+ * matching against Node. Cargo builds it on first use under the `tools` profile.
12
+ *
13
+ * `spm_train` is built from the google/sentencepiece tag the runtime and the Python wheel were built from, with the
14
+ * CMake recipe of `packages/sentencepiece-wasm/build.sh` minus emscripten. The checkout and build live under the
15
+ * cache root, outside the repository.
16
+ */
17
+ /**
18
+ * The SentencePiece release every tokenizer is trained with, and the commit its tag names.
19
+ */
20
+ export declare const SENTENCEPIECE: {
21
+ readonly version: "0.2.2";
22
+ readonly tag: "v0.2.2";
23
+ readonly commit: "e0cce7d37b065b5140349dbe12c6bcf6192fdd78";
24
+ };
25
+ /**
26
+ * The path of a current `mtf-tokenizer` build, building it the first time a process asks.
27
+ */
28
+ export declare function mtfTokenizerBinary(): Promise<string>;
29
+ /**
30
+ * Run one `mtf-tokenizer` command and parse the JSON it prints.
31
+ */
32
+ export declare function runMTFTokenizer<T>(args: readonly string[]): Promise<T>;
33
+ /**
34
+ * The `spm_train` to run: `explicit` when given, otherwise a build of {@linkcode SENTENCEPIECE}
35
+ * under the cache root, cloned and compiled the first time.
36
+ */
37
+ export declare function spmTrainBinary(explicit?: string | null): Promise<string>;
38
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../tools/tokenizer/binary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAUH;;GAEG;AACH,eAAO,MAAM,aAAa;aACzB,OAAO,EAAE,OAAO;aAChB,GAAG,EAAE,QAAQ;aACb,MAAM,EAAE,0CAA0C;CACzC,CAAA;AASV;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAWpD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAI5E;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C9E"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The two native programs the tokenizer tools run: `mtf-tokenizer`, built from `crates/mtf-tools`, and
7
+ * SentencePiece v0.2.2's `spm_train`.
8
+ *
9
+ * `mtf-tokenizer` is a binary rather than a Node addon. Each tool calls it a handful of times over files, so a
10
+ * process per call costs milliseconds. A binary also builds without an addon toolchain, a per-platform artifact or ABI
11
+ * matching against Node. Cargo builds it on first use under the `tools` profile.
12
+ *
13
+ * `spm_train` is built from the google/sentencepiece tag the runtime and the Python wheel were built from, with the
14
+ * CMake recipe of `packages/sentencepiece-wasm/build.sh` minus emscripten. The checkout and build live under the
15
+ * cache root, outside the repository.
16
+ */
17
+ import { cacheRootPath } from "@mailwoman/core/data-root";
18
+ import { isFile } from "@mailwoman/core/fs/readers/stat";
19
+ import { makeDirectories } from "@mailwoman/core/fs/writers";
20
+ import { git, gitHead } from "@mailwoman/core/git";
21
+ import { parseJSONStrict } from "@mailwoman/core/json";
22
+ import { repoRootPath, workspacePath } from "@mailwoman/core/paths";
23
+ import { runFile } from "@mailwoman/core/process";
24
+ /**
25
+ * The SentencePiece release every tokenizer is trained with, and the commit its tag names.
26
+ */
27
+ export const SENTENCEPIECE = {
28
+ version: "0.2.2",
29
+ tag: "v0.2.2",
30
+ commit: "e0cce7d37b065b5140349dbe12c6bcf6192fdd78",
31
+ };
32
+ /**
33
+ * Child output can be a full model inspection, so the buffer is far above Node's 1 MB default.
34
+ */
35
+ const OUTPUT_LIMIT = 1 << 30;
36
+ let mtfTokenizerBuild = null;
37
+ /**
38
+ * The path of a current `mtf-tokenizer` build, building it the first time a process asks.
39
+ */
40
+ export function mtfTokenizerBinary() {
41
+ mtfTokenizerBuild ??= (async () => {
42
+ await runFile("cargo", ["build", "--profile", "tools", "--locked", "-p", "mtf-tools"], {
43
+ cwd: workspacePath("mtf"),
44
+ maxBuffer: OUTPUT_LIMIT,
45
+ });
46
+ return repoRootPath("target", "tools", "mtf-tokenizer");
47
+ })();
48
+ return mtfTokenizerBuild;
49
+ }
50
+ /**
51
+ * Run one `mtf-tokenizer` command and parse the JSON it prints.
52
+ */
53
+ export async function runMTFTokenizer(args) {
54
+ const { stdout } = await runFile(await mtfTokenizerBinary(), args, { maxBuffer: OUTPUT_LIMIT });
55
+ return parseJSONStrict(stdout);
56
+ }
57
+ /**
58
+ * The `spm_train` to run: `explicit` when given, otherwise a build of {@linkcode SENTENCEPIECE}
59
+ * under the cache root, cloned and compiled the first time.
60
+ */
61
+ export async function spmTrainBinary(explicit) {
62
+ if (explicit) {
63
+ if (!(await isFile(explicit)))
64
+ throw new Error(`--spm-train ${explicit} is not a file`);
65
+ return explicit;
66
+ }
67
+ const root = cacheRootPath(`sentencepiece-${SENTENCEPIECE.tag}`);
68
+ const source = `${root}/src`;
69
+ const build = `${root}/build`;
70
+ const binary = `${build}/src/spm_train`;
71
+ if (await isFile(binary))
72
+ return binary;
73
+ await makeDirectories(root);
74
+ if (!(await isFile(`${source}/CMakeLists.txt`))) {
75
+ await git([
76
+ "clone",
77
+ "--quiet",
78
+ "--depth",
79
+ "1",
80
+ "--branch",
81
+ SENTENCEPIECE.tag,
82
+ "https://github.com/google/sentencepiece.git",
83
+ source,
84
+ ], root);
85
+ }
86
+ const head = await gitHead(source);
87
+ if (head !== SENTENCEPIECE.commit) {
88
+ throw new Error(`${source} is at ${head}, not ${SENTENCEPIECE.tag} (${SENTENCEPIECE.commit})`);
89
+ }
90
+ await runFile("cmake", ["-S", source, "-B", build, "-DCMAKE_BUILD_TYPE=Release", "-DSPM_ENABLE_SHARED=OFF", "-DSPM_ENABLE_TCMALLOC=OFF"], { maxBuffer: OUTPUT_LIMIT });
91
+ await runFile("cmake", ["--build", build, "-j", "4", "--target", "spm_train"], { maxBuffer: OUTPUT_LIMIT });
92
+ return binary;
93
+ }
94
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../tools/tokenizer/binary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B,OAAO,EAAE,OAAO;IAChB,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,0CAA0C;CACzC,CAAA;AAEV;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,CAAA;AAE5B,IAAI,iBAAiB,GAA2B,IAAI,CAAA;AAEpD;;GAEG;AACH,MAAM,UAAU,kBAAkB;IACjC,iBAAiB,KAAK,CAAC,KAAK,IAAI,EAAE;QACjC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE;YACtF,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC;YACzB,SAAS,EAAE,YAAY;SACvB,CAA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AAA;IACF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAElC,IAAI,IAAI,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,UAAU,IAAI,SAAS,aAAa,CAAC,GAAG,KAAK,aAAa,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/F,CAAC;IAED,MAAM,OAAO,CACZ,OAAO,EACP,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,2BAA2B,CAAC,EACjH,EAAE,SAAS,EAAE,YAAY,EAAE,CAC3B,CAAA;IAED,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAA;IAE3G,OAAO,MAAM,CAAA;AACd,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The rate at which a tokenizer falls back to raw bytes, overall and per script.
7
+ *
8
+ * `mtf-tokenizer byte-fallback` encodes each line with the model and assigns it a script from the Unicode name of
9
+ * its letters, through the tables `mtf-channels` generates from CPython's Unicode database.
10
+ */
11
+ /**
12
+ * One bucket's counts.
13
+ *
14
+ * `rate` is `byte_fallback_pieces / pieces`, or 0 for a bucket with no pieces.
15
+ */
16
+ export interface ByteFallbackTally {
17
+ lines: number;
18
+ pieces: number;
19
+ byte_fallback_pieces: number;
20
+ rate: number;
21
+ }
22
+ /**
23
+ * The overall tally and one per script, keyed in the order each script first appeared.
24
+ */
25
+ export interface ByteFallbackReport {
26
+ overall: ByteFallbackTally;
27
+ per_script: Record<string, ByteFallbackTally>;
28
+ }
29
+ /**
30
+ * Encode each non-blank line of `lines`, stripped, and tally its byte-fallback pieces.
31
+ */
32
+ export declare function measureByteFallback(model: string, lines: readonly string[]): Promise<ByteFallbackReport>;
33
+ /**
34
+ * The texts of a held-out fixture: a JSONL file's `raw`, `text` or `input` field
35
+ * per object line, or each line of a plain-text file.
36
+ * Empty lines are skipped.
37
+ */
38
+ export declare function readFixtureLines(path: string): Promise<string[]>;
39
+ //# sourceMappingURL=byte-fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"byte-fallback.d.ts","sourceRoot":"","sources":["../../../tools/tokenizer/byte-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB,EAAE,MAAM,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;CAC7C;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAY9G;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAmBtE"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * The rate at which a tokenizer falls back to raw bytes, overall and per script.
7
+ *
8
+ * `mtf-tokenizer byte-fallback` encodes each line with the model and assigns it a script from the Unicode name of
9
+ * its letters, through the tables `mtf-channels` generates from CPython's Unicode database.
10
+ */
11
+ import { readLocalTextFile } from "@mailwoman/core/fs/readers";
12
+ import { temporaryDirectory } from "@mailwoman/core/fs/temporary";
13
+ import { writeLocalJSONFile } from "@mailwoman/core/fs/writers";
14
+ import { parseJSONStrict } from "@mailwoman/core/json";
15
+ import { runMTFTokenizer } from "./binary.js";
16
+ /**
17
+ * Encode each non-blank line of `lines`, stripped, and tally its byte-fallback pieces.
18
+ */
19
+ export async function measureByteFallback(model, lines) {
20
+ await using scratch = await temporaryDirectory("mtf-byte-fallback-");
21
+ const input = scratch.path("lines.json").toString();
22
+ await writeLocalJSONFile(lines, input);
23
+ const report = await runMTFTokenizer(["byte-fallback", "--model", model, "--lines", input]);
24
+ return { overall: report.overall, per_script: Object.fromEntries(report.per_script) };
25
+ }
26
+ /**
27
+ * The texts of a held-out fixture: a JSONL file's `raw`, `text` or `input` field
28
+ * per object line, or each line of a plain-text file.
29
+ * Empty lines are skipped.
30
+ */
31
+ export async function readFixtureLines(path) {
32
+ const lines = [];
33
+ for (const line of (await readLocalTextFile(path)).split(/\r\n|\r|\n/)) {
34
+ if (!line)
35
+ continue;
36
+ if (line.trimStart().startsWith("{")) {
37
+ const record = parseJSONStrict(line);
38
+ const value = record["raw"] || record["text"] || record["input"];
39
+ if (value) {
40
+ lines.push(String(value));
41
+ }
42
+ }
43
+ else {
44
+ lines.push(line);
45
+ }
46
+ }
47
+ return lines;
48
+ }
49
+ //# sourceMappingURL=byte-fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"byte-fallback.js","sourceRoot":"","sources":["../../../tools/tokenizer/byte-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAs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ACjB,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAA;AACb,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A SentencePiece model's vocabulary, read and edited through `mtf-tokenizer`, and an encoder over it through the
7
+ * `@mailwoman/mtf` runtime.
8
+ */
9
+ import { type MTFModel } from "#index";
10
+ /**
11
+ * `ModelProto.SentencePiece.Type`, by wire value.
12
+ */
13
+ export declare const PieceType: {
14
+ readonly Normal: 1;
15
+ readonly Unknown: 2;
16
+ readonly Control: 3;
17
+ readonly UserDefined: 4;
18
+ readonly Unused: 5;
19
+ readonly Byte: 6;
20
+ };
21
+ export type PieceType = (typeof PieceType)[keyof typeof PieceType];
22
+ /**
23
+ * One vocabulary entry.
24
+ * `score` is the stored `float32`, widened exactly.
25
+ */
26
+ export type VocabularyPiece = readonly [piece: string, score: number, type: PieceType];
27
+ /**
28
+ * Every piece of the model at `path`, in id order.
29
+ */
30
+ export declare function readModelPieces(path: string): Promise<VocabularyPiece[]>;
31
+ /**
32
+ * The edits `mtf-tokenizer edit` applies, in this order.
33
+ */
34
+ export interface ModelEdit {
35
+ /**
36
+ * The piece ids to keep, in the order to keep them.
37
+ */
38
+ keep?: readonly number[];
39
+ /**
40
+ * Pieces to append after the kept ones.
41
+ */
42
+ append?: readonly VocabularyPiece[];
43
+ /**
44
+ * The flag names of the training call that wrote the model.
45
+ *
46
+ * The trainer and normalizer spec fields without a corresponding flag are dropped.
47
+ * This turns a native `spm_train` model into the bytes the Python wheel writes.
48
+ */
49
+ wheelFlags?: readonly string[];
50
+ }
51
+ /**
52
+ * What an edit dropped from each spec, by field number.
53
+ */
54
+ export interface ModelEditSummary {
55
+ pieces: number;
56
+ dropped_fields: {
57
+ trainer?: number[];
58
+ normalizer?: number[];
59
+ };
60
+ }
61
+ /**
62
+ * Write `source` with `edit` applied to `destination`, which may be `source` itself.
63
+ */
64
+ export declare function editModel(source: string, destination: string, edit: ModelEdit): Promise<ModelEditSummary>;
65
+ /**
66
+ * The model at `path`, loaded into the WebAssembly runtime.
67
+ * Dispose it after use.
68
+ */
69
+ export declare function loadEncoder(path: string): Promise<MTFModel>;
70
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../tools/tokenizer/model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAgB,KAAK,QAAQ,EAAc,MAAM,QAAQ,CAAA;AAIhE;;GAEG;AACH,eAAO,MAAM,SAAS;aACrB,MAAM,EAAE,CAAC;aACT,OAAO,EAAE,CAAC;aACV,OAAO,EAAE,CAAC;aACV,WAAW,EAAE,CAAC;aACd,MAAM,EAAE,CAAC;aACT,IAAI,EAAE,CAAC;CACE,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AAEtF;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAQ9E;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;IACnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAC7D;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAe/G;AAID;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAIjE"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * A SentencePiece model's vocabulary, read and edited through `mtf-tokenizer`, and an encoder over it through the
7
+ * `@mailwoman/mtf` runtime.
8
+ */
9
+ import { readLocalBuffer, readLocalJSONFile } from "@mailwoman/core/fs/readers";
10
+ import { temporaryDirectory } from "@mailwoman/core/fs/temporary";
11
+ import { replaceFileAtomically, writeLocalJSONFile } from "@mailwoman/core/fs/writers";
12
+ import { MTF_WASM_URL, MTFRuntime } from "#index";
13
+ import { runMTFTokenizer } from "./binary.js";
14
+ /**
15
+ * `ModelProto.SentencePiece.Type`, by wire value.
16
+ */
17
+ export const PieceType = {
18
+ Normal: 1,
19
+ Unknown: 2,
20
+ Control: 3,
21
+ UserDefined: 4,
22
+ Unused: 5,
23
+ Byte: 6,
24
+ };
25
+ /**
26
+ * Every piece of the model at `path`, in id order.
27
+ */
28
+ export async function readModelPieces(path) {
29
+ await using scratch = await temporaryDirectory("mtf-inspect-");
30
+ const out = scratch.path("pieces.json").toString();
31
+ await runMTFTokenizer(["inspect", path, "--out", out]);
32
+ const { pieces } = await readLocalJSONFile(out);
33
+ return pieces;
34
+ }
35
+ /**
36
+ * Write `source` with `edit` applied to `destination`, which may be `source` itself.
37
+ */
38
+ export async function editModel(source, destination, edit) {
39
+ await using scratch = await temporaryDirectory("mtf-edit-");
40
+ const plan = scratch.path("plan.json").toString();
41
+ const staged = scratch.path("model").toString();
42
+ await writeLocalJSONFile({ keep: edit.keep ?? null, append: edit.append ?? null, wheel_flags: edit.wheelFlags ?? null }, plan);
43
+ const summary = await runMTFTokenizer(["edit", source, "--plan", plan, "--out", staged]);
44
+ await replaceFileAtomically(staged, destination);
45
+ return summary;
46
+ }
47
+ let runtime = null;
48
+ /**
49
+ * The model at `path`, loaded into the WebAssembly runtime.
50
+ * Dispose it after use.
51
+ */
52
+ export async function loadEncoder(path) {
53
+ runtime ??= readLocalBuffer(MTF_WASM_URL).then((bytes) => MTFRuntime.instantiate(new Uint8Array(bytes)));
54
+ return (await runtime).loadModel(await readLocalBuffer(path));
55
+ }
56
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../tools/tokenizer/model.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEtF,OAAO,EAAE,YAAY,EAAiB,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,CAAC;IACd,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACE,CAAA;AAUV;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY;IACjD,YAAY,OAAO,GAAG,MAAM,kBAAkB,CAAC,cAAc,CAAC,CAAA;IAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,C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O,CAAC,MAAM,OAAO,CAAC,CAAC,SAAS,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;AAC9D,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Prune a tokenizer's unused pieces and the matching rows of an int8 model's embedding table.
7
+ *
8
+ * A piece that never won a Viterbi path contributes no score to any other path, so segmentation is unchanged for
9
+ * every input whose best path avoided the pruned pieces. The kept pieces stay in their order. The embedding rows
10
+ * are gathered by the old-to-new id map with the scale and zero point untouched, so each kept row stays the same
11
+ * bytes.
12
+ */
13
+ /**
14
+ * The quantized embedding table of the BIO token classifier.
15
+ */
16
+ export declare const QUANTIZED_EMBEDDING = "inner.token_embeddings.weight_quantized";
17
+ /**
18
+ * The id map `prunePieces` writes as `id-map.json`: the kept old ids in order,
19
+ * and each old id's new id or -1.
20
+ */
21
+ export interface PruneIDMap {
22
+ kept_ids: number[];
23
+ old_to_new: number[];
24
+ }
25
+ export interface PruneReport {
26
+ vocab_before: number;
27
+ vocab_after: number;
28
+ train_fired: number;
29
+ eval_fired: number;
30
+ single_codepoint_kept: number;
31
+ tokenizer_bytes: {
32
+ before: number;
33
+ after: number;
34
+ };
35
+ onnx_bytes: {
36
+ before: number;
37
+ after: number;
38
+ };
39
+ }
40
+ export interface PruneOptions {
41
+ tokenizer: string;
42
+ onnx: string;
43
+ /**
44
+ * A JSON file whose `counts` is each piece's use count over the training corpus,
45
+ * as `utilization.run.ts` writes.
46
+ */
47
+ trainCounts: string;
48
+ /**
49
+ * A JSON file whose `fired_ids` lists the pieces the evaluation surface uses.
50
+ */
51
+ evalFired: string;
52
+ outDirectory: string;
53
+ }
54
+ /**
55
+ * The pieces to keep: every piece the training corpus or the evaluation surface used, every
56
+ * piece that is not a normal piece (control, unknown, user-defined, unused and byte pieces),
57
+ * and every piece of at most one code point once a leading `▁` is removed.
58
+ * This keeps every character reachable.
59
+ */
60
+ export declare function keepSet(vocabulary: readonly (readonly [string, number, number])[], counts: readonly number[], evalFired: readonly number[]): {
61
+ keep: boolean[];
62
+ singleCodepoint: number;
63
+ };
64
+ /**
65
+ * Write the pruned `tokenizer.model`, `model.onnx`, `id-map.json`
66
+ * and `prune-report.json` under the output directory.
67
+ */
68
+ export declare function prunePieces(options: PruneOptions): Promise<PruneReport>;
69
+ //# sourceMappingURL=prune.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prune.d.ts","sourceRoot":"","sources":["../../../tools/tokenizer/prune.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH;;GAEG;AACH,eAAO,MAAM,mBAAmB,4CAA4C,CAAA;AAE5E;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,WAAW;IAC3B,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,eAAe,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAClD,UAAU,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC7C;AAED,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACtB,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MA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