summaryrefslogtreecommitdiff
path: root/tools/whistle-eval/build-data.mjs
diff options
context:
space:
mode:
authorTom Cooks <tommasogagliardi+github@gmail.com>2026-10-10 15:42:04 -0400
committerTom Cooks <tommasogagliardi+github@gmail.com>2026-10-10 15:42:04 -0400
commit901bf58c5cf9151942f8c4cd4e1427a02dec4b52 (patch)
treee9e312fb9893881f142a6f79e30417cd0c3f2be8 /tools/whistle-eval/build-data.mjs
parent6db1714d0354d1e1105e330ce84c46a54487c3bb (diff)
downloadreccoon-901bf58c5cf9151942f8c4cd4e1427a02dec4b52.tar.gz
RECCoon 1.0.0: rebrand to Tom Cooks, Parakeet-only, GPLv3, F-Droid-ready
Diffstat (limited to 'tools/whistle-eval/build-data.mjs')
-rw-r--r--tools/whistle-eval/build-data.mjs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/whistle-eval/build-data.mjs b/tools/whistle-eval/build-data.mjs
new file mode 100644
index 0000000..20be062
--- /dev/null
+++ b/tools/whistle-eval/build-data.mjs
@@ -0,0 +1,19 @@
+// Rebuilds the fp32 ONNX external-data files from the compact whistle.pack.
+// This is the "small weights" path: instead of committing ~145 MB of .onnx.data
+// to git (or downloading it), keep the 17 MB pack and expand it on first run.
+import fs from 'fs';
+import { parsePack, buildModelData } from './vendor/js/pack.js';
+
+const root = new URL('./vendor/', import.meta.url);
+const packBytes = fs.readFileSync(new URL('whistle.pack', root));
+const pack = parsePack(
+ packBytes.buffer.slice(packBytes.byteOffset, packBytes.byteOffset + packBytes.byteLength));
+
+for (const name of ['encoder', 'decoder']) {
+ const target = new URL(`onnx/${name}.onnx.data`, root);
+ const data = buildModelData(pack, name, (p) => {
+ process.stdout.write(`\r${name}: ${(p * 100).toFixed(0)}% `);
+ });
+ fs.writeFileSync(target, data);
+ process.stdout.write(`\r${name}: wrote ${data.length} bytes\n`);
+}