-
Notifications
You must be signed in to change notification settings - Fork 29.9k
[ASR pipline] fix with datasets 4.0 #39504
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
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
_array = _audio_samples.data | ||
_array = _array[0] if _array.shape[0] == 1 else _array |
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.
so this is to make it (num_samples,)
as we know it is mono
, right
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.
euh, wait.
Would it possible be (num_samples, ) with num_samples=1
(for datasets < 4.0
and mono) ...
probably not a realistic situation
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.
edge case wizard here! nice catch, should never happen but still can be easily handled , added a change 😊
if inputs.ndim != 1: | ||
logger.warning(f"We expect a single channel audio input for AutomaticSpeechRecognitionPipeline, got {inputs.ndim}. Taking the mean of the channels for mono conversion.") | ||
inputs = inputs.mean(axis=0) |
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.
If you are certain this is what we want, OK for me.
(but previously, it worked with (2, num_samples) if stereo
here?)
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.
Yes! as long as we warn the user it is okay, such meaning is commonly done 😉
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.
Thank you
Just wondering if #39309 is still relevant after this PR ? |
What does this PR do?
Cf code comments!