emilstabil commited on
Commit
d3c4073
·
verified ·
1 Parent(s): 6af66db

Prepare counted Hugging Face model downloads

Browse files
README.md CHANGED
@@ -22,7 +22,10 @@ Audio and transcripts are never sent to an inference server. The most recent
22
  saved.
23
 
24
  The model URLs and checksums are pinned in [`model-config.json`](model-config.json).
25
- The first load downloads Tiny and then PnC. Microphone access requires a secure
 
 
 
26
  origin and the browser's permission prompt, shown after the app's introductory
27
  mic dialog. Browser support remains a preview while physical-device and mobile
28
  checks are completed.
 
22
  saved.
23
 
24
  The model URLs and checksums are pinned in [`model-config.json`](model-config.json).
25
+ For the public release, the browser downloads Tiny's runtime configuration and
26
+ ONNX files, then PnC's files, directly from their Hugging Face model repos. The
27
+ private preview serves verified local copies while those repos remain private.
28
+ Microphone access requires a secure
29
  origin and the browser's permission prompt, shown after the app's introductory
30
  mic dialog. Browser support remains a preview while physical-device and mobile
31
  checks are completed.
model-config.json CHANGED
@@ -2,11 +2,8 @@
2
  "schema": "ekko-browser-model-v1",
3
  "name": "Ekko v1 Tiny int8",
4
  "repository": "RyeAI/ekko-v1-tiny",
5
- "revision": "f1070717d45491f941a1486affe53fef5f7104ad",
6
  "runtime": "sherpa-onnx 1.13.6 WebAssembly",
7
- "sampleRate": 16000,
8
- "featureDim": 80,
9
- "modelType": "nemo_transducer",
10
  "pnc": {
11
  "name": "Ekko PnC v2 int8",
12
  "repository": "RyeAI/ekko-pnc",
@@ -35,6 +32,12 @@
35
  ]
36
  },
37
  "files": [
 
 
 
 
 
 
38
  {
39
  "path": "nemo-transducer-encoder.onnx",
40
  "url": "model-files/tiny/nemo-transducer-encoder.onnx?sha256=e7ee366cb92cbf5b14beee01f04245293185ec3b271bb12acd7715e94d1f4cf2",
 
2
  "schema": "ekko-browser-model-v1",
3
  "name": "Ekko v1 Tiny int8",
4
  "repository": "RyeAI/ekko-v1-tiny",
5
+ "revision": "e37e698805c538e447c25062ab13fa862462ee9e",
6
  "runtime": "sherpa-onnx 1.13.6 WebAssembly",
 
 
 
7
  "pnc": {
8
  "name": "Ekko PnC v2 int8",
9
  "repository": "RyeAI/ekko-pnc",
 
32
  ]
33
  },
34
  "files": [
35
+ {
36
+ "path": "runtime-config.json",
37
+ "url": "model-files/tiny/runtime-config.json?sha256=197ec64ea58975cb70c8bac645593bbaaa7ac7b261999b35b7d2986a26a41da5",
38
+ "sha256": "197ec64ea58975cb70c8bac645593bbaaa7ac7b261999b35b7d2986a26a41da5",
39
+ "bytes": 121
40
+ },
41
  {
42
  "path": "nemo-transducer-encoder.onnx",
43
  "url": "model-files/tiny/nemo-transducer-encoder.onnx?sha256=e7ee366cb92cbf5b14beee01f04245293185ec3b271bb12acd7715e94d1f4cf2",
model-files/tiny/runtime-config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "ekko-tiny-onnx-runtime-v1",
3
+ "sampleRate": 16000,
4
+ "featureDim": 80,
5
+ "modelType": "nemo_transducer"
6
+ }
validation.json CHANGED
@@ -13,7 +13,7 @@
13
  "bundle_bytes_approximate": 13600000
14
  },
15
  "model": {
16
- "revision": "f1070717d45491f941a1486affe53fef5f7104ad",
17
  "download_bytes": 135307048,
18
  "local_verified_cache_server": true,
19
  "reason": "The private v5 artifact revision loaded through the checksum-verified local cache server."
@@ -178,7 +178,7 @@
178
  },
179
  "v5_browser_wasm_smoke": {
180
  "status": "passed-local-private-preview",
181
- "model_revision": "f1070717d45491f941a1486affe53fef5f7104ad",
182
  "int8_bundle_bytes": 135307058,
183
  "current_matrix_mean_wer": 12.945774,
184
  "one_word_fixture_seconds": 0.47,
 
13
  "bundle_bytes_approximate": 13600000
14
  },
15
  "model": {
16
+ "revision": "e37e698805c538e447c25062ab13fa862462ee9e",
17
  "download_bytes": 135307048,
18
  "local_verified_cache_server": true,
19
  "reason": "The private v5 artifact revision loaded through the checksum-verified local cache server."
 
178
  },
179
  "v5_browser_wasm_smoke": {
180
  "status": "passed-local-private-preview",
181
+ "model_revision": "e37e698805c538e447c25062ab13fa862462ee9e",
182
  "int8_bundle_bytes": 135307058,
183
  "current_matrix_mean_wer": 12.945774,
184
  "one_word_fixture_seconds": 0.47,
worker.js CHANGED
@@ -179,12 +179,12 @@ async function fetchVerified(file, completedBytes, totalBytes) {
179
  return bytes;
180
  }
181
 
182
- function createRecognizer(config) {
183
  recognizer = new OfflineRecognizer(
184
  {
185
  featConfig: {
186
- sampleRate: config.sampleRate,
187
- featureDim: config.featureDim,
188
  },
189
  modelConfig: {
190
  transducer: {
@@ -193,7 +193,7 @@ function createRecognizer(config) {
193
  joiner: "./nemo-transducer-joiner.onnx",
194
  },
195
  tokens: "./tokens.txt",
196
- modelType: config.modelType,
197
  provider: "cpu",
198
  numThreads: 1,
199
  debug: 0,
@@ -233,12 +233,25 @@ async function initialize(configUrl) {
233
 
234
  const totalBytes = config.files.reduce((sum, file) => sum + file.bytes, 0);
235
  let completedBytes = 0;
 
236
  for (const file of config.files) {
237
  const bytes = await fetchVerified(file, completedBytes, totalBytes);
238
- Module.FS.writeFile(file.path, bytes);
 
 
 
 
239
  completedBytes += bytes.byteLength;
240
  }
241
- createRecognizer(config);
 
 
 
 
 
 
 
 
242
  self.postMessage({
243
  type: "ready",
244
  model: config.name,
 
179
  return bytes;
180
  }
181
 
182
+ function createRecognizer(runtimeConfig) {
183
  recognizer = new OfflineRecognizer(
184
  {
185
  featConfig: {
186
+ sampleRate: runtimeConfig.sampleRate,
187
+ featureDim: runtimeConfig.featureDim,
188
  },
189
  modelConfig: {
190
  transducer: {
 
193
  joiner: "./nemo-transducer-joiner.onnx",
194
  },
195
  tokens: "./tokens.txt",
196
+ modelType: runtimeConfig.modelType,
197
  provider: "cpu",
198
  numThreads: 1,
199
  debug: 0,
 
233
 
234
  const totalBytes = config.files.reduce((sum, file) => sum + file.bytes, 0);
235
  let completedBytes = 0;
236
+ let runtimeConfig = null;
237
  for (const file of config.files) {
238
  const bytes = await fetchVerified(file, completedBytes, totalBytes);
239
+ if (file.path === "runtime-config.json") {
240
+ runtimeConfig = JSON.parse(new TextDecoder().decode(bytes));
241
+ } else {
242
+ Module.FS.writeFile(file.path, bytes);
243
+ }
244
  completedBytes += bytes.byteLength;
245
  }
246
+ if (
247
+ runtimeConfig?.schema !== "ekko-tiny-onnx-runtime-v1" ||
248
+ runtimeConfig.sampleRate !== SAMPLE_RATE ||
249
+ runtimeConfig.featureDim !== 80 ||
250
+ runtimeConfig.modelType !== "nemo_transducer"
251
+ ) {
252
+ throw new Error("Ukendt Tiny runtimekonfiguration");
253
+ }
254
+ createRecognizer(runtimeConfig);
255
  self.postMessage({
256
  type: "ready",
257
  model: config.name,