Repository navigation
Copy the VAD context instead of writing through a view - #1725
Open
Arjun-Sivasankar wants to merge 1 commit into
Open
Arjun-Sivasankar wants to merge 1 commit into
Arjun-Sivasankar wants to merge 1 commit into
Conversation
SileroVADModel.__call__ took the per-window context as a basic slice of the reshaped audio, which is a view. Zeroing its last row (the silent context for window 0 after the roll) therefore also zeroed the last 64 samples of the audio: the final window was scored on modified samples, and a caller's buffer was changed in place whenever reshape returned a view. Take a copy of the slice and add regression tests that check the input is left unchanged and the last window matches a reference computed from a copy. Fixes SYSTRAN#1688
Arjun-Sivasankar
force-pushed
the
fix-vad-context-view
branch
from
November 25, 2026 13:43
dca58e5 to
b87eb68
Compare
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.
Fixes #1688
Problem
SileroVADModel.__call__builds the per-window context with a basic slice of the reshaped audio:The slice is a view, so zeroing its last row also zeroes the last 64 samples of the audio. The final window is then scored on modified samples, and when
reshapereturns a view the caller's array is changed in place.Change
.copy()), one line infaster_whisper/vad.py.tests/test_vad.pywith two regression tests:Testing
masterand pass with the fix.pytest tests/: 20 passed, 1 failed. The failure istest_cliptimestamps_segments(expected " And so my fellow Americans ... your country." and got lower-case text without the final period). It fails in the same way on unmodifiedmasterin my environment (Windows, Python 3.13, CPU) and does not use the VAD, so it is unrelated to this change.black,isortandflake8pass on the changed files.