Repository navigation
Fix ASR pipeline mono conversion for channels-last audio (fixes #47886) #47888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Rocketknight1
merged 4 commits into
huggingface:main
from
Kayvan-Zahiri:fix/asr-stereo-channel-axis
Aug 19, 2026
+81
−6
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f395a6a
Fix ASR pipeline mono conversion for channels-last audio
Kayvan-Zahiri bb6f79e
Reject ambiguous channel layouts instead of inferring the channel axis
Kayvan-Zahiri 0f76ab6
Correct the comment on why the downmix runs before resampling
Kayvan-Zahiri 4214809
Apply suggestion from @Rocketknight1
Rocketknight1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Reject ambiguous channel layouts instead of inferring the channel axis
Per review: inferring the channel axis with argmin is unsafe. It picks an arbitrary axis for ndim >= 3, and it silently downmixes 5.1 audio where the weighting should be the caller's choice. Keep the documented (channels, samples) layout, which is what torchcodec returns, and raise when the input does not conform. A channels-last array gets an error naming the transpose, rather than a transcription of two samples. Also move the conversion ahead of F.resample. The resampler operates on the last axis, so a multi-channel array had to be reduced first, and the stride arithmetic reads shape[0] as samples.
- Loading branch information
commit bb6f79e1c835855b1409ab6d466c1da2f3bdc9e3
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.