Skip to content

asr model evaluator addition + doc#378

Merged
lvwerra merged 2 commits into
huggingface:mainfrom
bayartsogt-ya:speech-to-text-evaluator-branch
Dec 9, 2022
Merged

asr model evaluator addition + doc#378
lvwerra merged 2 commits into
huggingface:mainfrom
bayartsogt-ya:speech-to-text-evaluator-branch

Conversation

@bayartsogt-ya

Copy link
Copy Markdown
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

HuggingFaceDocBuilderDev commented Dec 8, 2022

Copy link
Copy Markdown

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

@lvwerra lvwerra left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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?

random_state=random_state,
)

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

lvwerra commented Dec 8, 2022

Copy link
Copy Markdown
Member

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!

@bayartsogt-ya
bayartsogt-ya force-pushed the speech-to-text-evaluator-branch branch from 4d5eba7 to 3bd2788 Compare December 8, 2022 16:08
@lvwerra

lvwerra commented Dec 9, 2022

Copy link
Copy Markdown
Member

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.

3 participants