csukuangfj
commited on
Commit
•
f9b0165
1
Parent(s):
683f81c
update model
Browse files- sherpa-onnx-asr.js +17 -2
- sherpa-onnx-wasm-main-asr.js +0 -0
- sherpa-onnx-wasm-main-asr.wasm +2 -2
sherpa-onnx-asr.js
CHANGED
@@ -393,11 +393,13 @@ function initSherpaOnnxOfflineNemoEncDecCtcModelConfig(config, Module) {
|
|
393 |
function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
|
394 |
const encoderLen = Module.lengthBytesUTF8(config.encoder) + 1;
|
395 |
const decoderLen = Module.lengthBytesUTF8(config.decoder) + 1;
|
|
|
|
|
396 |
|
397 |
-
const n = encoderLen + decoderLen;
|
398 |
const buffer = Module._malloc(n);
|
399 |
|
400 |
-
const len =
|
401 |
const ptr = Module._malloc(len);
|
402 |
|
403 |
let offset = 0;
|
@@ -405,12 +407,25 @@ function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
|
|
405 |
offset += encoderLen;
|
406 |
|
407 |
Module.stringToUTF8(config.decoder, buffer + offset, decoderLen);
|
|
|
|
|
|
|
|
|
|
|
|
|
408 |
|
409 |
offset = 0;
|
410 |
Module.setValue(ptr, buffer + offset, 'i8*');
|
411 |
offset += encoderLen;
|
412 |
|
413 |
Module.setValue(ptr + 4, buffer + offset, 'i8*');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
return {
|
416 |
buffer: buffer, ptr: ptr, len: len,
|
|
|
393 |
function initSherpaOnnxOfflineWhisperModelConfig(config, Module) {
|
394 |
const encoderLen = Module.lengthBytesUTF8(config.encoder) + 1;
|
395 |
const decoderLen = Module.lengthBytesUTF8(config.decoder) + 1;
|
396 |
+
const languageLen = Module.lengthBytesUTF8(config.language) + 1;
|
397 |
+
const taskLen = Module.lengthBytesUTF8(config.task) + 1;
|
398 |
|
399 |
+
const n = encoderLen + decoderLen + languageLen + taskLen;
|
400 |
const buffer = Module._malloc(n);
|
401 |
|
402 |
+
const len = 4 * 4; // 4 pointers
|
403 |
const ptr = Module._malloc(len);
|
404 |
|
405 |
let offset = 0;
|
|
|
407 |
offset += encoderLen;
|
408 |
|
409 |
Module.stringToUTF8(config.decoder, buffer + offset, decoderLen);
|
410 |
+
offset += decoderLen;
|
411 |
+
|
412 |
+
Module.stringToUTF8(config.language, buffer + offset, languageLen);
|
413 |
+
offset += languageLen;
|
414 |
+
|
415 |
+
Module.stringToUTF8(config.task, buffer + offset, taskLen);
|
416 |
|
417 |
offset = 0;
|
418 |
Module.setValue(ptr, buffer + offset, 'i8*');
|
419 |
offset += encoderLen;
|
420 |
|
421 |
Module.setValue(ptr + 4, buffer + offset, 'i8*');
|
422 |
+
offset += decoderLen;
|
423 |
+
|
424 |
+
Module.setValue(ptr + 8, buffer + offset, 'i8*');
|
425 |
+
offset += languageLen;
|
426 |
+
|
427 |
+
Module.setValue(ptr + 12, buffer + offset, 'i8*');
|
428 |
+
offset += taskLen;
|
429 |
|
430 |
return {
|
431 |
buffer: buffer, ptr: ptr, len: len,
|
sherpa-onnx-wasm-main-asr.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
sherpa-onnx-wasm-main-asr.wasm
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e52381cf2f6b8c19e508598f6a6657b013404996e51c58a4bd0c90f185e395a3
|
3 |
+
size 10606106
|