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
Next
Next commit
Fix ASR pipeline mono conversion for channels-last audio
The pipeline averaged multi-channel input over a hardcoded axis 0, which assumes channels-first. soundfile.read, librosa.load(mono=False) and scipy.io.wavfile.read all return channels-last, so a stereo waveform was averaged across time and collapsed to one value per channel: 48000 samples became 2, were padded back to silence, and transcribed as " you" with only a warning saying the conversion had succeeded. Infer the channel axis from the shorter dimension instead, and report the actual shape rather than ndim, which always printed 2 for any 2-D input.
- Loading branch information
commit f395a6ae64f89e62d5b2fb31b2d9d36397f05f99
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels extremely dangerous to me! If we want to be robust to either
(samples, channels)or(channels, samples)then we should be much more explicit; and probably only do this for dims of1or2- if you have 5.1 audio then you can handle downmixing yourself 😅