Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Buffered Audio Data #2265

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

kentslaney
Copy link

This pull request adds the CLI flag --buffered, which allows the audio data to be loaded on-demand through an I/O buffer instead of all at once at the beginning. This provides an alternative resolution to the problem addressed in #2256. The default memory limit is dictated here, but shouldn't matter much since it's not a bottleneck.

Support for buffered input also paves the way towards real-time tasks (#2): the changes were directly adapted from kentslaney/realtime-whisper, which already supports live PCM data. In order to keep the PR from being any larger than it already is, changes were limited to the minimum motivating feature. I'm making a PR instead of keeping it as a wrapper because it reuses/refactors large chunks of transcribe, which the current scoping makes inaccessible for patching.

The buffered version will perform almost exactly the same set of operations, with a small (vanishing) difference in the preprocessing output. The log mel spectogram is clamped below to have a maximum range of 8. The original transcribe method computes the upper bound from the entire file's spectogram, while the buffered version clamps the values relative to the maximum in the chunks processed so far. I have done some regression testing to confirm that the refactored (non-buffered) solution will make the same calls as the existing one.

I realize this is a rather large PR. Please let me know if these changes are outside the scope of the repo or if there's anything I can do to make it easier to review.

@gabriel370pp
Copy link

Uploading Screenrecorder-2024-07-22-02-17-04-378.mp4…

@gabriel370pp
Copy link

Vv

@kentslaney kentslaney marked this pull request as draft July 22, 2024 16:04
@kentslaney kentslaney marked this pull request as ready for review July 22, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants