Repository navigation
audio-mel: FFT instead of the direct DFT in MelSpectrogram - #20
Merged
Merged
Conversation
PowerSpectrum: a mixed-radix FFT for any frame size — closed-form radix 4, 2 and 5 butterflies, radix 3 and larger factors by the plain sum — so Whisper's 400-point frame (4*4*5*5) needs no power-of-two size. Twiddles in double precision, buffers per call (MelSpectrogram stays safe to share across threads), no more 640 KB cos/sin tables. Each mel filter is summed over its non-zero band only (exact: the skipped terms are 0). - JVM: 5.8 ms per 4 s Whisper window instead of 38 ms - arm32 Android device (ART), Whisper tiny transcription: log-mel ≈ 0.2 s instead of ≈ 0.88 s, same transcript - vs the whisper.log_mel_spectrogram golden: cosine 0.99999999 (was 0.99999998) - PowerSpectrumTest (commonTest, jvm + linuxX64): power against a double-precision direct DFT for 400, 512, every radix path, primes and 7*7; a pure tone; factorization
Merged
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.
MelSpectrogramcomputed each frame's power spectrum with a direct DFT over precomputed cos/sin tables:O(n²/2)per frame and 640 KB of tables for Whisper'snFft = 400. This replaces it with an FFT.What changes
PowerSpectrum(internal): a mixed-radix FFT for any frame size.logMelcall, soMelSpectrogramis still safe to share across threads.Numbers
whisper.log_mel_spectrogramgolden (MelSpectrogramTest)Tests
PowerSpectrumTestincommonTest, green onjvmandlinuxX64:The existing mel tests pass unchanged.