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

asr model evaluator addition + doc #378

Merged

Conversation

bayartsogt-ya
Copy link
Contributor

@lewtun

As discussed #324, I am adding automatic-speech-recognition evaluator here.

Since automatic-speech-recognition pipeline already exists and it supports both Wav2Vec2 and Whisper, I think it is safe addition.

I did have some concern where wer and cer metrics both returning float while contract says it should be dict.
So I kind of hacked the way around by checking the type, but definitely want to hear your opinion on this.

Thanks!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Dec 8, 2022

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

Copy link
Member

@lvwerra lvwerra left a comment

Choose a reason for hiding this comment

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

Hi @bayartsogt-ya, thank you for this incredibly clean PR! Just one small nit and I'll fix the output format of WER/CER.

Comment on lines 73 to 88
"""
Examples:
```python
>>> from evaluate import evaluator
>>> from datasets import load_dataset
>>> task_evaluator = evaluator("automatic-speech-recognition")
>>> data = load_dataset("mozilla-foundation/common_voice_11_0", "en", split="validation[:40]")
>>> results = task_evaluator.compute(
>>> model_or_pipeline="https://huggingface.co/openai/whisper-tiny.en",
>>> data=data,
>>> input_column="path",
>>> label_column="sentence",
>>> metric="wer",
>>> )
```
"""
Copy link
Member

Choose a reason for hiding this comment

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

For the other Evaluators we added the example also to a string at the beginning that we then added with @add_end_docstrings. Could we do the same here for uniformity?

@@ -267,6 +267,12 @@ def compute(
random_state=random_state,
)

# TODO: To clarify why `wer` and `cer` return float
Copy link
Member

Choose a reason for hiding this comment

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

That's an oversight in the standardization of the metrics. Let me fix that in a separate PR so we can remove this here.

Copy link
Member

Choose a reason for hiding this comment

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

Actually that will probably break a few things so let's keep your workaround for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This sounds great and thanks for making this change! Let me merge with your branch and do changes accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

Let's actually keep your workaround for now.

@lvwerra lvwerra mentioned this pull request Dec 8, 2022
@lvwerra
Copy link
Member

lvwerra commented Dec 8, 2022

Hi @bayartsogt-ya, see my comment above: can you keep your workaround and just fix the docstring. also no need to merge the upstream branch into yours then. Thanks!

@lvwerra
Copy link
Member

lvwerra commented Dec 9, 2022

Awesome, thanks for this addition!

@lvwerra lvwerra merged commit 81d34e4 into huggingface:main Dec 9, 2022
@bayartsogt-ya bayartsogt-ya deleted the speech-to-text-evaluator-branch branch December 10, 2022 00:37
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.

None yet

3 participants