fix: wire flash_attention config field through to WhisperContextParam…#298
Open
graysky2 wants to merge 1 commit intopeteonrails:mainfrom
Open
fix: wire flash_attention config field through to WhisperContextParam…#298graysky2 wants to merge 1 commit intopeteonrails:mainfrom
graysky2 wants to merge 1 commit intopeteonrails:mainfrom
Conversation
…eters The flash_attention field in [whisper] config was parsed from config.toml but never passed to WhisperContextParameters before model initialization, causing it to be silently ignored on all backends. Fix: pass config.flash_attention to ctx_params.flash_attn() in WhisperTranscriber::new(), and add the missing field to WhisperConfig struct and its Default impl. Tested on RTX 5060 Ti with large-v3-turbo, 6-minute audio file: Backend flash_attn encode buffer wall time (avg 3 runs) ------- ---------- ------------- --------- CUDA off 212 MB 7.00s Vulkan off 220 MB 6.54s CUDA on 55 MB 6.27s Vulkan on 55 MB 6.26s ~10% reduction in wall time. Encode buffer reduced by ~75%, consistent with flash attention avoiding full attention matrix materialization.
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.
Description
The flash_attention field in [whisper] config was parsed from config.toml but never passed to WhisperContextParameters before model initialization, causing it to be silently ignored on all backends.
Fix: pass config.flash_attention to ctx_params.flash_attn() in WhisperTranscriber::new(), and add the missing field to WhisperConfig struct and its Default impl.
Tested on RTX 5060 Ti with large-v3-turbo, 6-minute audio file:
~10% reduction in wall time. Encode buffer reduced by ~75%, consistent with flash attention avoiding full attention matrix materialization.
Brief description of the changes in this PR.
Related Issue
Fixes #(issue number)
Type of Change
Testing
cargo testand all tests passcargo clippywith no warningscargo fmtDocumentation
Additional Notes
Any additional information reviewers should know.