diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index ecd0490..6b6b3b5 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -43,6 +43,7 @@ jobs: run: hugo --minify - name: Deploy + if: github.event_name != 'pull_request' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/assets/js/modelFactories.js b/assets/js/modelFactories.js index cff72a6..0fb9ba9 100644 --- a/assets/js/modelFactories.js +++ b/assets/js/modelFactories.js @@ -5,6 +5,7 @@ function createModelLoader(model_name) { const load_model = async ({ progress_callback = undefined }) => { if (model === null) { model = await pipeline("automatic-speech-recognition", model_name, { + quantized: true, progress_callback, }); } diff --git a/assets/js/whisper.worker.js b/assets/js/whisper.worker.js index fc5df29..014ba09 100644 --- a/assets/js/whisper.worker.js +++ b/assets/js/whisper.worker.js @@ -28,14 +28,17 @@ async function transcribe(audio, model_name) { }); sendLoadingMessage("success"); - const stride_length_s = 5; + const isDistilWhisper = model_name.includes("distil-whisper"); + const stride_length_s = isDistilWhisper ? 3 : 5; const generationTracker = new GenerationTracker(pipeline, stride_length_s); + await pipeline(audio, { - top_k: 0, // TODO: make this configurable via request - do_sample: false, // TODO: make this configurable via request - chunk_length_s: 30, // TODO: make this configurable via request - stride_length_s: stride_length_s, // TODO: make this configurable via request + top_k: 0, + do_sample: false, + chunk_length_s: isDistilWhisper ? 20 : 30, + stride_length_s: stride_length_s, return_timestamps: true, + force_full_sequences: false, callback_function: generationTracker.callbackFunction.bind(generationTracker), chunk_callback: generationTracker.chunkCallback.bind(generationTracker),