|
40 | 40 |
|
41 | 41 | Note that the computation is quite heavy and may take a few seconds to complete.<br> |
42 | 42 | The transcription results will be displayed in the text area below.<br><br> |
43 | | - <b>Important: your browser must support WASM SIMD instructions for this to work.</b> |
| 43 | + <b>Important: your browser must support WASM SIMD instructions for this to work</b><br><br> |
| 44 | + <b>Important: quantized models are still in experimental stage</b> |
44 | 45 |
|
45 | 46 | <br><br><hr> |
46 | 47 |
|
47 | 48 | <div id="model"> |
48 | | - Whisper model: <span id="model-whisper-status"></span> |
| 49 | + Whisper models: <span id="model-whisper-status"></span><br><br> |
49 | 50 | <button id="fetch-whisper-tiny-en" onclick="loadWhisper('tiny.en')">tiny.en (75 MB)</button> |
50 | 51 | <button id="fetch-whisper-tiny" onclick="loadWhisper('tiny')">tiny (75 MB)</button> |
51 | 52 | <button id="fetch-whisper-base-en" onclick="loadWhisper('base.en')">base.en (142 MB)</button> |
52 | 53 | <button id="fetch-whisper-base" onclick="loadWhisper('base')">base (142 MB)</button> |
53 | 54 | <button id="fetch-whisper-small-en" onclick="loadWhisper('small.en')">small.en (466 MB)</button> |
54 | 55 | <button id="fetch-whisper-small" onclick="loadWhisper('small')">small (466 MB)</button> |
55 | | - <span id="fetch-whisper-progress"></span> |
56 | | - |
57 | 56 | <input type="file" id="whisper-file" name="file" onchange="loadFile(event, 'whisper.bin')" /> |
| 57 | + <br><br> |
| 58 | + Quantized models:<br><br> |
| 59 | + <button id="fetch-whisper-base-en-q4_0" onclick="loadWhisper('base-en-q4_0')">base.en (4bit, 49 MB)</button> |
| 60 | + <button id="fetch-whisper-base-q4_0" onclick="loadWhisper('base-q4_0')">base (4bit, 49 MB)</button> |
| 61 | + <button id="fetch-whisper-small-en-q4_0" onclick="loadWhisper('small-en-q4_0')">small.en (4bit, 152 MB)</button> |
| 62 | + <button id="fetch-whisper-small-q4_0" onclick="loadWhisper('small-q4_0')">small (4bit, 152 MB)</button><br> |
| 63 | + <button id="fetch-whisper-medium-en-q4_0" onclick="loadWhisper('medium-en-q4_0')">medium.en (4bit, 469 MB)</button> |
| 64 | + <button id="fetch-whisper-medium-q4_0" onclick="loadWhisper('medium-q4_0')">medium (4bit, 469 MB)</button> |
| 65 | + <button id="fetch-whisper-large-q4_0" onclick="loadWhisper('large-q4_0')">large (4bit, 985 MB)</button> |
| 66 | + <span id="fetch-whisper-progress"></span> |
58 | 67 | </div> |
59 | 68 |
|
60 | 69 | <br> |
|
263 | 272 |
|
264 | 273 | Module.FS_createDataFile("/", fname, buf, true, true); |
265 | 274 |
|
266 | | - model_whisper = fname; |
| 275 | + //model_whisper = fname; |
267 | 276 |
|
268 | 277 | document.getElementById('model-whisper-status').innerHTML = 'loaded "' + model_whisper + '"!'; |
269 | 278 |
|
|
292 | 301 | document.getElementById('fetch-whisper-tiny' ).style.display = 'none'; |
293 | 302 | document.getElementById('fetch-whisper-base' ).style.display = 'none'; |
294 | 303 | document.getElementById('fetch-whisper-small' ).style.display = 'none'; |
| 304 | + |
| 305 | + document.getElementById('fetch-whisper-base-en-q4_0' ).style.display = 'none'; |
| 306 | + document.getElementById('fetch-whisper-base-q4_0' ).style.display = 'none'; |
| 307 | + document.getElementById('fetch-whisper-small-en-q4_0' ).style.display = 'none'; |
| 308 | + document.getElementById('fetch-whisper-small-q4_0' ).style.display = 'none'; |
| 309 | + document.getElementById('fetch-whisper-medium-en-q4_0').style.display = 'none'; |
| 310 | + document.getElementById('fetch-whisper-medium-q4_0' ).style.display = 'none'; |
| 311 | + document.getElementById('fetch-whisper-large-q4_0' ).style.display = 'none'; |
| 312 | + |
295 | 313 | document.getElementById('whisper-file' ).style.display = 'none'; |
296 | 314 | document.getElementById('model-whisper-status' ).innerHTML = 'loaded model: ' + file.name; |
297 | 315 | } |
|
304 | 322 | 'base': 'https://whisper.ggerganov.com/ggml-model-whisper-base.bin', |
305 | 323 | 'small.en': 'https://whisper.ggerganov.com/ggml-model-whisper-small.en.bin', |
306 | 324 | 'small': 'https://whisper.ggerganov.com/ggml-model-whisper-small.bin', |
| 325 | + |
| 326 | + 'base-en-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-base.en-q4_0.bin', |
| 327 | + 'base-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-base-q4_0.bin', |
| 328 | + 'small-en-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-small.en-q4_0.bin', |
| 329 | + 'small-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-small-q4_0.bin', |
| 330 | + 'medium-en-q4_0':'https://whisper.ggerganov.com/ggml-model-whisper-medium.en-q4_0.bin', |
| 331 | + 'medium-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-medium-q4_0.bin', |
| 332 | + 'large-q4_0': 'https://whisper.ggerganov.com/ggml-model-whisper-large-q4_0.bin', |
307 | 333 | }; |
308 | 334 |
|
309 | 335 | let sizes = { |
|
313 | 339 | 'base': 142, |
314 | 340 | 'small.en': 466, |
315 | 341 | 'small': 466, |
| 342 | + |
| 343 | + 'base-en-q4_0': 49, |
| 344 | + 'base-q4_0': 49, |
| 345 | + 'small-en-q4_0': 152, |
| 346 | + 'small-q4_0': 152, |
| 347 | + 'medium-en-q4_0': 469, |
| 348 | + 'medium-q4_0': 469, |
| 349 | + 'large-q4_0': 985, |
316 | 350 | }; |
317 | 351 |
|
318 | 352 | let url = urls[model]; |
|
327 | 361 | document.getElementById('fetch-whisper-tiny' ).style.display = 'none'; |
328 | 362 | document.getElementById('fetch-whisper-base' ).style.display = 'none'; |
329 | 363 | document.getElementById('fetch-whisper-small' ).style.display = 'none'; |
| 364 | + |
| 365 | + document.getElementById('fetch-whisper-base-en-q4_0' ).style.display = 'none'; |
| 366 | + document.getElementById('fetch-whisper-base-q4_0' ).style.display = 'none'; |
| 367 | + document.getElementById('fetch-whisper-small-en-q4_0' ).style.display = 'none'; |
| 368 | + document.getElementById('fetch-whisper-small-q4_0' ).style.display = 'none'; |
| 369 | + document.getElementById('fetch-whisper-medium-en-q4_0').style.display = 'none'; |
| 370 | + document.getElementById('fetch-whisper-medium-q4_0' ).style.display = 'none'; |
| 371 | + document.getElementById('fetch-whisper-large-q4_0' ).style.display = 'none'; |
| 372 | + |
330 | 373 | document.getElementById('whisper-file' ).style.display = 'none'; |
331 | 374 | document.getElementById('model-whisper-status' ).innerHTML = 'loading model: ' + model; |
332 | 375 |
|
|
343 | 386 | el = document.getElementById('fetch-whisper-tiny' ); if (el) el.style.display = 'inline-block'; |
344 | 387 | el = document.getElementById('fetch-whisper-base' ); if (el) el.style.display = 'inline-block'; |
345 | 388 | el = document.getElementById('fetch-whisper-small' ); if (el) el.style.display = 'inline-block'; |
| 389 | + |
| 390 | + el = document.getElementById('fetch-whisper-large-q4_0'); if (el) el.style.display = 'inline-block'; |
| 391 | + |
346 | 392 | el = document.getElementById('whisper-file' ); if (el) el.style.display = 'inline-block'; |
347 | 393 | el = document.getElementById('model-whisper-status' ); if (el) el.innerHTML = ''; |
348 | 394 | }; |
|
354 | 400 | // audio file |
355 | 401 | // |
356 | 402 |
|
357 | | - const kMaxAudio_s = 120; |
| 403 | + const kMaxAudio_s = 30*60; |
358 | 404 | const kSampleRate = 16000; |
359 | 405 |
|
360 | 406 | window.AudioContext = window.AudioContext || window.webkitAudioContext; |
|
0 commit comments