-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Fix some doc examples in task summary #16666
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
Fix some doc examples in task summary #16666
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
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.
LGTM! For the audio file, @stevhliu might know where it is.
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 these!
The jfk_moon_speech.wav is a local file I used to test some code examples, so maybe we can replace it with an audio example from the Hub?
Sure! Let me try. Haven't tried audio dataset from the Hub. |
|
@sgugger @stevhliu I was able to use a file from dataset. One example of change is >>> from transformers import pipeline
>>> from datasets import load_dataset
>>> import torch
>>> torch.manual_seed(42) # doctest: +IGNORE_RESULT
>>> dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
>>> dataset = dataset.sort("id")
>>> audio_file = dataset[0]["audio"]["path"]
>>> audio_classifier = pipeline(
... task="audio-classification", model="ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
... )
>>> predictions = audio_classifier(audio_file)
>>> predictions = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in predictions]
>>> predictions
[{'score': 0.1315, 'label': 'calm'}, {'score': 0.1307, 'label': 'neutral'}, {'score': 0.1274, 'label': 'sad'}, {'score': 0.1261, 'label': 'fearful'}, {'score': 0.1242, 'label': 'happy'}]I ran the tests, and Let me know if you have further comments :-) |
* Fix some doc examples Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
What does this PR do?
Fix some doctest CI failure found here
A few failures:
There is one error I haven't fixed yet
Do you know where to get this file for testing purpose ..?