KEMBAR78
Adding support for `array` key in raw dictionnaries in ASR pipeline. by Narsil · Pull Request #16827 · huggingface/transformers · GitHub
Skip to content

Conversation

@Narsil
Copy link
Contributor

@Narsil Narsil commented Apr 19, 2022

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 prevent
loading a huge audio in RAM upfront.

Performance-wise the iterator also enables using stuff like batch_size and num_workers in the
pipeline object to get optimal performance (this will only show real differences on GPU which is not
included in this quicktour)

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

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

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Apr 19, 2022

The documentation is not available anymore as the PR was closed or merged.

```py
>>> raw_audio_waveforms = [d["array"] for d in dataset[:4]["audio"]]
>>> speech_recognizer(raw_audio_waveforms)
>>> speech_recognizer(dataset[:4]["audio"])
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done !

Copy link
Collaborator

@sgugger sgugger left a 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!

@Narsil Narsil merged commit e789418 into huggingface:main Apr 21, 2022
@Narsil Narsil deleted the improve_asr_quicktour branch April 21, 2022 12:39
elusenji pushed a commit to elusenji/transformers that referenced this pull request Jun 12, 2022
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants