Fix mel spectrogram preprocessor allocating gigabytes of planned memory#18238
Merged
manuelcandales merged 2 commits intorelease/1.2from Mar 18, 2026
Merged
Conversation
…ry (#18229) The dynamic dimension max was computed as max_audio_len * n_samples (samples per 30s chunk), not max_audio_len * sampling_rate. With max_audio_len=300, this produced 144M samples (150 minutes) instead of 4.8M (5 minutes), causing a ~3.3 GB planned buffer for STFT intermediates. For streaming mode, the max was even worse: 600 * 480K = 288M samples, producing a 6.6 GB planned buffer — even though streaming processes ~1640 samples per step. Fix both paths: - Offline: use max_audio_len * sampling_rate (300s → 4.8M samples, ~110 MB) - Streaming: cap at 2 seconds (32K samples, ~0.7 MB) Peak RSS for voxtral runner: (before) 9,556 MB, after (4,712 MB) (cherry picked from commit 776979f)
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18238
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 Cancelled JobsAs of commit a759487 with merge base 8c0a60b ( CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces excessive planned memory allocation when exporting WhisperAudioProcessor by correcting the dynamic input dimension upper bound used for torch.export, preventing multi-GB buffer plans in both offline and streaming preprocessors.
Changes:
- Fix offline export dynamic max dimension to use
max_audio_len * sampling_rate(samples), instead ofmax_audio_len * n_samples. - Add a streaming-specific export bound to keep the memory plan tight by capping max input samples (currently to 2 seconds).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
manuelcandales
approved these changes
Mar 18, 2026
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.
The dynamic dimension max was computed as max_audio_len * n_samples
(samples per 30s chunk), not max_audio_len * sampling_rate. With
max_audio_len=300, this produced 144M samples (150 minutes) instead of
4.8M (5 minutes), causing a ~3.3 GB planned buffer for STFT
intermediates.
For streaming mode, the max was even worse: 600 * 480K = 288M samples,
producing a 6.6 GB planned buffer — even though streaming processes
~1640 samples per step.
Fix both paths:
Peak RSS for voxtral runner: (before) 9,556 MB, after (4,712 MB)