Add VAD pre-filter for transcription#69
Merged
Merged
Conversation
Member
|
Hey! |
Contributor
Author
|
Thanks for the quick reply! Don't have a strong reason, I was being conservative. Going to flip it to opt-out :) |
faster-whisper already bundles Silero VAD; this exposes it via STT_WHISPER2_VAD_FILTER and four tuning env vars. Enabled by default; set STT_WHISPER2_VAD_FILTER=0 to restore previous behaviour. Signed-off-by: Nils Imdahl <imdahlnils@gmail.com>
4ecd163 to
91f0c1e
Compare
There was a problem hiding this comment.
Pull request overview
Plumbs faster-whisper’s built-in Silero VAD options through to the transcription call so deployments can optionally pre-filter silence via environment variables, helping reduce hallucinations on long/silent recordings.
Changes:
- Add VAD env-var configuration (filter toggle + parameter mapping) in
lib/main.py. - Pass
vad_filter/vad_parametersintoWhisperModel.transcribe()when enabled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the Silero VAD that is already bundled with faster-whisper as an opt-in pre-filter, configurable via env vars. Default behaviour is unchanged (STT_WHISPER2_VAD_FILTER defaults to 0), so this is a no-op for existing deployments.
Why
For longer recordings or recordings with longer silences whisper starts to hallucinate or use repeated phrases. VAD helps mitigate this while also cutting down the amount of audio that needs to be transcribed.
How
faster-whisper.WhisperModel.transcribe() already accepts vad_filter and vad_parameters. The VAD model is part of the package's bundled assets. No extra download, no extra dependency. This PR just plumbs the flags through from environment variables.
Config
All variables are optional. Defaults are the same as faster whisper's defaults.
If there is interest in adding this: Is there a good place to document these? The Readme and/or the wiki?
Testing
I'm unsure if i should add an integration test for this path. This would double the cli pipeline time so I decided to wait on feedback first.