Skip to content
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

[docs] add quick usage snippet to Whisper. #31289

Merged

Conversation

Vaibhavs10
Copy link
Member

What does this PR do?

The aim of this PR is to add a simple code snippet that anyone stumbling upon the Whisper documentation can look at and get to "Whispering" ASAP.

Internal slack thread for context

Once we agree on a structure I'd like to open a more bigger PR to add such for top visited text-generation models and image/ VLMs too.

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 can review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@LysandreJik @stevhliu @osanseviero @pcuenca

@HuggingFaceDocBuilderDev

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.

import torch
from transformers import pipeline

whisper = pipeline("automatic-speech-recognition", "openai/whisper-large-v3", torch_dtype=torch.float16)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also load to GPU?

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

I wonder if you could even put the code examples right above # Overview to help users get started even faster. They're probably not too interested in reading the abstract anyways.

You can probably even get away without adding any text to focus it even more on the code. The user would just see three tabs for selecting their GPU, copy/paste the corresponding code example, and start whispering.

For any other details (or if they're just curious), users could then choose to explore the rest of the doc.

@stevhliu stevhliu mentioned this pull request Jun 27, 2024
Copy link

github-actions bot commented Jul 7, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@osanseviero
Copy link
Contributor

Not stale

Copy link

github-actions bot commented Aug 2, 2024

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@Vaibhavs10
Copy link
Member Author

Not stale

@huggingface huggingface deleted a comment from github-actions bot Aug 27, 2024
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

Let's merge it as is and eventually iterate on it later? Done is better than perfect

@Vaibhavs10 Vaibhavs10 merged commit 6f0ecf1 into huggingface:main Aug 27, 2024
8 checks passed
@Vaibhavs10 Vaibhavs10 deleted the vb/update-whisper-documentation branch August 27, 2024 12:11
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* [docs] add quick usage snippet to Whisper.

* Apply suggestions from review.

* 💉 Fix the device for pipeline.
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.

5 participants