You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains the code for the Open ASR Leaderboard. The leaderboard is a Gradio Space that allows users to compare the accuracy of ASR models on a variety of datasets. The leaderboard is hosted at [open-asr-leaderboard/leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard).
3
+
This repository contains the code for the Open ASR Leaderboard. The leaderboard is a Gradio Space that allows users to compare the accuracy of ASR models on a variety of datasets. The leaderboard is hosted at [hf-audio/open_asr_leaderboard](https://huggingface.co/spaces/hf-audio/open_asr_leaderboard).
4
4
5
5
# Requirements
6
6
@@ -9,38 +9,220 @@ Each library has its own set of requirements. We recommend using a clean conda e
9
9
1) Clone this repository.
10
10
2) Install PyTorch by following the instructions here: https://pytorch.org/get-started/locally/
11
11
3) Install the common requirements for all library by running `pip install -r requirements/requirements.txt`.
12
-
4) If you wish to run NeMo, note that the benchmark currently needs CUDA 12.6 (`nvidia-smi` should output "CUDA Version: 12.6" or higher), to fix a problem in previous drivers for RNN-T inference with cooperative kernels inside of conditional nodes (see here: https://github.com/NVIDIA/NeMo/pull/9869)
13
-
5) Install the requirements for each library you wish to evalaute by running `pip install -r requirements/requirements_<library_name>.txt`.
14
-
6) Connect your Hugging Face account by running `huggingface-cli login`.
12
+
4) Install the requirements for each library you wish to evaluate by running `pip install -r requirements/requirements_<library_name>.txt`.
13
+
5) Connect your Hugging Face account by running `huggingface-cli login`.
14
+
15
+
**Note:** If you wish to run NeMo, the benchmark currently needs CUDA 12.6 to fix a problem in previous drivers for RNN-T inference with cooperative kernels inside conditional nodes (see here: https://github.com/NVIDIA/NeMo/pull/9869). Running `nvidia-smi` should output "CUDA Version: 12.6" or higher.
15
16
16
17
# Evaluate a model
17
18
18
-
Each library has a script `run_eval.py` that acts as the entry point for evaluating a model. The script is run by the corresponding bash script for each model that is being evalauted. The script then outputs a JSONL file containing the predictions of the model on each dataset, and summarizes the Word Error Rate of the model on each dataset after completion.
19
+
Each library has a script `run_eval.py` that acts as the entry point for evaluating a model. The script is run by the corresponding bash script for each model that is being evaluated. The script then outputs a JSONL file containing the predictions of the model on each dataset, and summarizes the Word Error Rate (WER) and Inverse Real-Time Factor (RTFx) of the model on each dataset after completion.
20
+
21
+
To reproduce existing results:
19
22
20
23
1) Change directory into the library you wish to evaluate. For example, `cd transformers`.
21
24
2) Run the bash script for the model you wish to evaluate. For example, `bash run_wav2vec2.sh`.
22
-
3)**Note**: All evaluations are done on single GPU. If you wish to run two scripts in parallel, please use `CUDA_VISIBLE_DEVICES=<0,1,...N-1>` prior to running the bash script, where `N` is the number of GPUs on your machine.
25
+
26
+
**Note**: All evaluations were run using an NVIDIA A100-SXM4-80GB GPU, with NVIDIA driver 560.28.03, CUDA 12.6, and PyTorch 2.4.0. You should ensure you use the same configuration when submitting results. If you are unable to create an equivalent machine, please request one of the maintainers to run your scripts for evaluation!
23
27
24
28
# Add a new library
25
29
26
-
To add a new library for evalution in this benchmark, please follow the steps below:
30
+
To add a new library for evaluation in this benchmark, please follow the steps below:
27
31
28
-
1) Fork this repository and create a new branch.
32
+
1) Fork this repository and create a new branch
29
33
2) Create a new directory for your library. For example, `mkdir transformers`.
30
-
3) Copy the `run_eval.py` script from an existing library into your new directory. For example, `cp transformers/run_eval.py <your_library>/run_eval.py`.
31
-
- Modify the script as needed, but please try to keep the structure of the script the same as others.
32
-
- In particular, the data loading, evaluation and manifest writing must be done in the same way as other libraries.
33
-
4) Create one bash file per model type following the convesion `run_<model_type>.sh`.
34
-
- The bash script should follow the same steps as other libraries.
34
+
3) Copy the template `run_eval.py` script below into your new directory. The script should be updated for the new library by making two modifications. Otherwise, please try to keep the structure of the script the same as in the template. In particular, the data loading, evaluation and manifest writing must be done in the same way as other libraries for consistency.
35
+
1) Update the model loading logic in the `main` function
36
+
2) Update the inference logic in the `benchmark` function
37
+
38
+
<details>
39
+
40
+
<summary> Template script for Transformers: </summary>
41
+
42
+
```python
43
+
import argparse
44
+
import os
45
+
import torch
46
+
from transformers import WhisperForConditionalGeneration, WhisperProcessor
47
+
import evaluate
48
+
from normalizer import data_utils
49
+
import time
50
+
from tqdm import tqdm
51
+
52
+
wer_metric = evaluate.load("wer")
53
+
54
+
defmain(args):
55
+
# Load model (FILL ME!)
56
+
model = WhisperForConditionalGeneration.from_pretrained(args.model_id, torch_dtype=torch.bfloat16).to(args.device)
help="Model identifier. Should be loadable with 🤗 Transformers",
156
+
)
157
+
parser.add_argument(
158
+
"--dataset_path",
159
+
type=str,
160
+
default="esb/datasets",
161
+
help="Dataset path. By default, it is `esb/datasets`",
162
+
)
163
+
parser.add_argument(
164
+
"--dataset",
165
+
type=str,
166
+
required=True,
167
+
help="Dataset name. *E.g.* `'librispeech_asr` for the LibriSpeech ASR dataset, or `'common_voice'` for Common Voice. The full list of dataset names "
168
+
"can be found at `https://huggingface.co/datasets/esb/datasets`",
169
+
)
170
+
parser.add_argument(
171
+
"--split",
172
+
type=str,
173
+
default="test",
174
+
help="Split of the dataset. *E.g.* `'validation`' for the dev split, or `'test'` for the test split.",
175
+
)
176
+
parser.add_argument(
177
+
"--device",
178
+
type=int,
179
+
default=-1,
180
+
help="The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.",
181
+
)
182
+
parser.add_argument(
183
+
"--batch_size",
184
+
type=int,
185
+
default=1,
186
+
help="Number of samples to go through each streamed batch.",
187
+
)
188
+
parser.add_argument(
189
+
"--max_eval_samples",
190
+
type=int,
191
+
default=None,
192
+
help="Number of samples to be evaluated. Put a lower number e.g. 64 for testing this script.",
193
+
)
194
+
parser.add_argument(
195
+
"--no-streaming",
196
+
dest="streaming",
197
+
action="store_false",
198
+
help="Choose whether you'd like to download the entire dataset or stream it during the evaluation.",
199
+
)
200
+
parser.add_argument(
201
+
"--warmup_steps",
202
+
type=int,
203
+
default=10,
204
+
help="Number of warm-up steps to run before launching the timed runs.",
205
+
)
206
+
args = parser.parse_args()
207
+
parser.set_defaults(streaming=False)
208
+
209
+
main(args)
210
+
211
+
```
212
+
213
+
</details>
214
+
215
+
4) Create one bash file per model type following the conversion `run_<model_type>.sh`.
216
+
- The bash script should follow the same steps as other libraries. You can copy the example for [run_whisper.sh](./transformers/run_whisper.sh) and update it to your library
35
217
- Different model sizes of the same type should share the script. For example `Wav2Vec` and `Wav2Vec2` would be two separate scripts, but different size of `Wav2Vec2` would be part of the same script.
36
-
5) (Optional) You could also add a `calc_rtf.py` script for your library to evaluate the Real Time Factor of the model.
37
-
6) Submit a PR for your changes.
218
+
-**Important:** for a given model, you can tune decoding hyper-parameters to maximize benchmark performance (e.g. batch size, beam size, etc.). However, you must use the **same decoding hyper-parameters** for each dataset in the benchmark. For more details, refer to the [ESB paper](https://arxiv.org/abs/2210.13352).
219
+
5) Submit a PR for your changes.
38
220
39
221
# Add a new model
40
222
41
-
To add a new model for evalution in this benchmark, you can follow most of the steps noted above.
223
+
To add a model from a new library for evaluation in this benchmark, you can follow the steps noted above.
42
224
43
-
Since the library already exists in the benchmark, we can simplify the steps to:
225
+
To add a model from an existing library, we can simplify the steps to:
44
226
45
227
1) If the model is already supported, but of a different size, simply add the new model size to the list of models run by the corresponding bash script.
46
228
2) If the model is entirely new, create a new bash script based on others of that library and add the new model and its sizes to that script.
0 commit comments