diff --git a/examples/whisper.wasm/CMakeLists.txt b/examples/whisper.wasm/CMakeLists.txt index 48c31ad..d598dd6 100644 --- a/examples/whisper.wasm/CMakeLists.txt +++ b/examples/whisper.wasm/CMakeLists.txt @@ -32,8 +32,8 @@ set_target_properties(${TARGET} PROPERTIES LINK_FLAGS " \ --bind \ -s USE_PTHREADS=1 \ -s PTHREAD_POOL_SIZE=8 \ - -s INITIAL_MEMORY=1500MB \ - -s TOTAL_MEMORY=1500MB \ + -s INITIAL_MEMORY=2000MB \ + -s TOTAL_MEMORY=2000MB \ -s FORCE_FILESYSTEM=1 \ -s EXPORTED_RUNTIME_METHODS=\"['print', 'printErr', 'ccall', 'cwrap']\" \ ${EXTRA_FLAGS} \ diff --git a/examples/whisper.wasm/index-tmpl.html b/examples/whisper.wasm/index-tmpl.html index 358ed70..34a2a96 100644 --- a/examples/whisper.wasm/index-tmpl.html +++ b/examples/whisper.wasm/index-tmpl.html @@ -40,21 +40,34 @@ Note that the computation is quite heavy and may take a few seconds to complete.
The transcription results will be displayed in the text area below.

- Important: your browser must support WASM SIMD instructions for this to work. + Important: + -


+
- Whisper model: + Whisper models:

- - +

+ Quantized models:

+ + + +
+ + + +

@@ -263,7 +276,7 @@ Module.FS_createDataFile("/", fname, buf, true, true); - model_whisper = fname; + //model_whisper = fname; document.getElementById('model-whisper-status').innerHTML = 'loaded "' + model_whisper + '"!'; @@ -292,6 +305,15 @@ document.getElementById('fetch-whisper-tiny' ).style.display = 'none'; document.getElementById('fetch-whisper-base' ).style.display = 'none'; document.getElementById('fetch-whisper-small' ).style.display = 'none'; + + document.getElementById('fetch-whisper-base-en-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-base-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-small-en-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-small-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-medium-en-q4_0').style.display = 'none'; + document.getElementById('fetch-whisper-medium-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-large-q4_0' ).style.display = 'none'; + document.getElementById('whisper-file' ).style.display = 'none'; document.getElementById('model-whisper-status' ).innerHTML = 'loaded model: ' + file.name; } @@ -304,6 +326,14 @@ 'base': 'https://whisper.ggerganov.com/ggml-model-whisper-base.bin', 'small.en': 'https://whisper.ggerganov.com/ggml-model-whisper-small.en.bin', 'small': 'https://whisper.ggerganov.com/ggml-model-whisper-small.bin', + + 'base-en-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-base.en-q4_0.bin', + 'base-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-base-q4_0.bin', + 'small-en-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-small.en-q4_0.bin', + 'small-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-small-q4_0.bin', + 'medium-en-q4_0':'https://whisper.ggerganov.com/ggml-model-whisper-medium.en-q4_0.bin', + 'medium-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-medium-q4_0.bin', + 'large-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-large-q4_0.bin', }; let sizes = { @@ -313,6 +343,14 @@ 'base': 142, 'small.en': 466, 'small': 466, + + 'base-en-q4_0': 49, + 'base-q4_0': 49, + 'small-en-q4_0': 152, + 'small-q4_0': 152, + 'medium-en-q4_0': 469, + 'medium-q4_0': 469, + 'large-q4_0': 985, }; let url = urls[model]; @@ -327,6 +365,15 @@ document.getElementById('fetch-whisper-tiny' ).style.display = 'none'; document.getElementById('fetch-whisper-base' ).style.display = 'none'; document.getElementById('fetch-whisper-small' ).style.display = 'none'; + + document.getElementById('fetch-whisper-base-en-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-base-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-small-en-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-small-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-medium-en-q4_0').style.display = 'none'; + document.getElementById('fetch-whisper-medium-q4_0' ).style.display = 'none'; + document.getElementById('fetch-whisper-large-q4_0' ).style.display = 'none'; + document.getElementById('whisper-file' ).style.display = 'none'; document.getElementById('model-whisper-status' ).innerHTML = 'loading model: ' + model; @@ -343,6 +390,9 @@ el = document.getElementById('fetch-whisper-tiny' ); if (el) el.style.display = 'inline-block'; el = document.getElementById('fetch-whisper-base' ); if (el) el.style.display = 'inline-block'; el = document.getElementById('fetch-whisper-small' ); if (el) el.style.display = 'inline-block'; + + el = document.getElementById('fetch-whisper-large-q4_0'); if (el) el.style.display = 'inline-block'; + el = document.getElementById('whisper-file' ); if (el) el.style.display = 'inline-block'; el = document.getElementById('model-whisper-status' ); if (el) el.innerHTML = ''; }; @@ -354,7 +404,7 @@ // audio file // - const kMaxAudio_s = 120; + const kMaxAudio_s = 30*60; const kSampleRate = 16000; window.AudioContext = window.AudioContext || window.webkitAudioContext;