From 9d3587ecdf3d9e554484143de2fd16f021f9af12 Mon Sep 17 00:00:00 2001 From: Jordi Smit Date: Fri, 7 Jun 2024 11:41:50 +0200 Subject: [PATCH 1/2] fix: added forgette hyper parameters (#19) --- assets/js/modelFactories.js | 1 + assets/js/whisper.worker.js | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) 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), From 9abe5757be1b3210e1e5e9e4e96772d81acdfe0e Mon Sep 17 00:00:00 2001 From: Jordi Smit Date: Fri, 7 Jun 2024 11:47:28 +0200 Subject: [PATCH 2/2] fix: do not deploy during PR (#21) --- .github/workflows/cicd.yml | 1 + 1 file changed, 1 insertion(+) 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 }}