-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding support for array
key in raw dictionnaries in ASR pipeline.
#16827
Conversation
The documentation is not available anymore as the PR was closed or merged. |
@@ -134,8 +134,7 @@ Audio files are automatically loaded and resampled when calling the `"audio"` co | |||
Let's extract the raw waveform arrays of the first 4 samples and pass it as a list to the pipeline: | |||
|
|||
```py | |||
>>> raw_audio_waveforms = [d["array"] for d in dataset[:4]["audio"]] | |||
>>> speech_recognizer(raw_audio_waveforms) | |||
>>> speech_recognizer(dataset[:4]["audio"]) |
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.
Nice! Could you update the es
version as well?
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.
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.
Thanks for fixing this!
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
…uggingface#16827) * Adding support for `array` key in raw dictionnaries in ASR pipeline. * ES . * Update src/transformers/pipelines/automatic_speech_recognition.py Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * Making it work by not popping `array` first. * Black 22.3 Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
…uggingface#16827) * Adding support for `array` key in raw dictionnaries in ASR pipeline. * ES . * Update src/transformers/pipelines/automatic_speech_recognition.py Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * Making it work by not popping `array` first. * Black 22.3 Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
What does this PR do?
Adding support for
array
key in raw dictionnaries in ASR pipeline.This means we can simplify the Quicktour example to look again a bit
more what the old
ffmpeg
example looked like.Even simpler code might be enabled by
huggingface/datasets#4180
in the future. We could then remove the
[:4]
which is currently necessary to preventloading a huge audio in RAM upfront.
Performance-wise the iterator also enables using stuff like
batch_size
andnum_workers
in thepipeline object to get optimal performance (this will only show real differences on GPU which is not
included in this quicktour)
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@patrickvonplaten
@sgugger