Voxtral Realtime: Refactor StandardEncoderRingKVCache#17729
Open
manuelcandales wants to merge 2 commits intomainfrom
Open
Voxtral Realtime: Refactor StandardEncoderRingKVCache#17729manuelcandales wants to merge 2 commits intomainfrom
manuelcandales wants to merge 2 commits intomainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17729
Note: Links to docs will display an error until the docs builds have been completed. ❌ 12 New FailuresAs of commit 76c8860 with merge base bac3ad3 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors the streaming encoder cache classes to improve device and dtype consistency, ensuring all buffers are initialized to match the encoder's configuration. This helps prevent runtime errors and improves compatibility across different hardware and export scenarios.
Changes:
- Added dtype and device parameters to cache classes (
EncoderRingKVCacheandStandardEncoderRingKVCache) - Modified
StreamingAudioEncoderExportto infer dtype/device from encoder weights and use them consistently for all buffer initialization - Refactored
StandardEncoderRingKVCacheto inherit fromEncoderRingKVCache, eliminating code duplication
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request improves device and dtype consistency for streaming encoder buffers and cache classes in
voxtral_realtime/model.py. The main changes ensure that all buffers and caches are initialized with the same dtype and device as the encoder weights, which helps prevent runtime errors and improves compatibility across different hardware and export scenarios. It also refactors the cache classes for better code reuse and maintainability.Device and dtype consistency improvements:
EncoderRingKVCacheandStandardEncoderRingKVCacheclasses now acceptdtypeanddeviceparameters, ensuring their buffers (k_cache,v_cache) are initialized to match the encoder's configuration.StreamingAudioEncoderExportclass infersdtypeanddevicefrom encoder weights and uses them when initializing convolution states and cache buffers, ensuring all state is consistently placed and typed.Cache class refactoring and simplification:
StandardEncoderRingKVCachenow subclassesEncoderRingKVCacheto reduce code duplication, and its docstring clarifies its intended use for export scenarios.create_causal_maskmethod inStandardEncoderRingKVCacheis removed in favor of the inherited implementation.Other minor improvements:
create_causal_maskmethod inEncoderRingKVCachenow always uses the device of the cache buffer, simplifying device management.