Remove redundant audio decoding in CLI transcribe path#799
Open
hamzaq2000 wants to merge 1 commit into
Open
Conversation
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.
Why is this change needed?
fluidaudiocli transcribecurrently decodes batch audio three times: once into an unused buffer, once during unconditional resampling, and once insideAsrManager.transcribe.The decoded
bufferwas never used, so that read is removed. The second decode only supplied the sample-count log (removed) and custom-vocabulary samples. The CLI now passes normal files directly toAsrManager; with custom vocabulary, it decodes once and shares the samples between ASR and CTC.An existing long-form duration bug was also fixed, alongside the above main patch.
ChunkProcessorpassed an empty sample array when building its result to avoid materializing disk-backed audio, which produced a zero duration. The result builder now accepts a sample count instead, allowing chunked paths to pass their existingtotalSamplesvalue.Validation
Benchmarked Parakeet V3 on Apple M3 using a 1 hr mp3:
Yields a ~2.4x speedup with an 87% reduction in peak memory. The resulting transcript was byte-for-byte identical.
The equivalent WAV test showed no performance regression (15.29 s vs. 15.07 s) and also produced an identical transcript. A custom-vocabulary test likewise produced byte-identical output while improving from 2.50 s to 1.75 s.