csukuangfj commited on
Commit
3c0011c
·
1 Parent(s): 9031d87

update model

Browse files
sherpa-onnx-asr.js CHANGED
@@ -55,6 +55,10 @@ function freeConfig(config, Module) {
55
  freeConfig(config.wenetCtc, Module)
56
  }
57
 
 
 
 
 
58
  if ('moonshine' in config) {
59
  freeConfig(config.moonshine, Module)
60
  }
@@ -755,6 +759,23 @@ function initSherpaOnnxOfflineWenetCtcModelConfig(config, Module) {
755
  }
756
  }
757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
759
  const encoderLen = Module.lengthBytesUTF8(config.encoder || '') + 1;
760
  const decoderLen = Module.lengthBytesUTF8(config.decoder || '') + 1;
@@ -1025,6 +1046,12 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
1025
  };
1026
  }
1027
 
 
 
 
 
 
 
1028
  if (!('whisper' in config)) {
1029
  config.whisper = {
1030
  encoder: '',
@@ -1109,9 +1136,13 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
1109
  const wenetCtc =
1110
  initSherpaOnnxOfflineWenetCtcModelConfig(config.wenetCtc, Module);
1111
 
 
 
 
1112
  const len = transducer.len + paraformer.len + nemoCtc.len + whisper.len +
1113
  tdnn.len + 8 * 4 + senseVoice.len + moonshine.len + fireRedAsr.len +
1114
- dolphin.len + zipformerCtc.len + canary.len + wenetCtc.len;
 
1115
 
1116
  const ptr = Module._malloc(len);
1117
 
@@ -1222,12 +1253,15 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
1222
  Module._CopyHeap(wenetCtc.ptr, wenetCtc.len, ptr + offset);
1223
  offset += wenetCtc.len;
1224
 
 
 
 
1225
  return {
1226
  buffer: buffer, ptr: ptr, len: len, transducer: transducer,
1227
  paraformer: paraformer, nemoCtc: nemoCtc, whisper: whisper, tdnn: tdnn,
1228
  senseVoice: senseVoice, moonshine: moonshine, fireRedAsr: fireRedAsr,
1229
  dolphin: dolphin, zipformerCtc: zipformerCtc, canary: canary,
1230
- wenetCtc: wenetCtc,
1231
  }
1232
  }
1233
 
 
55
  freeConfig(config.wenetCtc, Module)
56
  }
57
 
58
+ if ('omnilingual' in config) {
59
+ freeConfig(config.omnilingual, Module)
60
+ }
61
+
62
  if ('moonshine' in config) {
63
  freeConfig(config.moonshine, Module)
64
  }
 
759
  }
760
  }
761
 
762
+ function initSherpaOnnxOfflineOmnilingualAsrCtcModelConfig(config, Module) {
763
+ const n = Module.lengthBytesUTF8(config.model || '') + 1;
764
+
765
+ const buffer = Module._malloc(n);
766
+
767
+ const len = 1 * 4; // 1 pointer
768
+ const ptr = Module._malloc(len);
769
+
770
+ Module.stringToUTF8(config.model || '', buffer, n);
771
+
772
+ Module.setValue(ptr, buffer, 'i8*');
773
+
774
+ return {
775
+ buffer: buffer, ptr: ptr, len: len,
776
+ }
777
+ }
778
+
779
  function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
780
  const encoderLen = Module.lengthBytesUTF8(config.encoder || '') + 1;
781
  const decoderLen = Module.lengthBytesUTF8(config.decoder || '') + 1;
 
1046
  };
1047
  }
1048
 
1049
+ if (!('omnilingual' in config)) {
1050
+ config.omnilingual = {
1051
+ model: '',
1052
+ };
1053
+ }
1054
+
1055
  if (!('whisper' in config)) {
1056
  config.whisper = {
1057
  encoder: '',
 
1136
  const wenetCtc =
1137
  initSherpaOnnxOfflineWenetCtcModelConfig(config.wenetCtc, Module);
1138
 
1139
+ const omnilingual = initSherpaOnnxOfflineOmnilingualAsrCtcModelConfig(
1140
+ config.omnilingual, Module);
1141
+
1142
  const len = transducer.len + paraformer.len + nemoCtc.len + whisper.len +
1143
  tdnn.len + 8 * 4 + senseVoice.len + moonshine.len + fireRedAsr.len +
1144
+ dolphin.len + zipformerCtc.len + canary.len + wenetCtc.len +
1145
+ omnilingual.len;
1146
 
1147
  const ptr = Module._malloc(len);
1148
 
 
1253
  Module._CopyHeap(wenetCtc.ptr, wenetCtc.len, ptr + offset);
1254
  offset += wenetCtc.len;
1255
 
1256
+ Module._CopyHeap(omnilingual.ptr, omnilingual.len, ptr + offset);
1257
+ offset += omnilingual.len;
1258
+
1259
  return {
1260
  buffer: buffer, ptr: ptr, len: len, transducer: transducer,
1261
  paraformer: paraformer, nemoCtc: nemoCtc, whisper: whisper, tdnn: tdnn,
1262
  senseVoice: senseVoice, moonshine: moonshine, fireRedAsr: fireRedAsr,
1263
  dolphin: dolphin, zipformerCtc: zipformerCtc, canary: canary,
1264
+ wenetCtc: wenetCtc, omnilingual: omnilingual
1265
  }
1266
  }
1267
 
sherpa-onnx-wasm-main-asr.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7696761b31fee476f829d2d5853a78cb4dc2bdb933e78bc642861ba62a36ec82
3
- size 11535148
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:376800d60547bf3475caf2821f7a99f219627bedb0d58405fe68d944233021f2
3
+ size 11535283