|
| 1 | +# Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +"""HuggingFace Open ASR Leaderboard evaluation for NeMo ASR models. |
| 16 | +
|
| 17 | +Runs the HF Open ASR Leaderboard benchmark (8 datasets, WER metric) on |
| 18 | +NeMo ASR models using the unified server with the nemo_asr or salm backend. |
| 19 | +
|
| 20 | +Uses 1 GPU for the server (NeMo ASR model). The evaluation client runs |
| 21 | +on CPU alongside it. |
| 22 | +
|
| 23 | +Example usage:: |
| 24 | +
|
| 25 | + # Evaluate parakeet-v3 (traditional ASR model -> nemo_asr backend) |
| 26 | + python recipes/asr/run_hf_leaderboard.py \\ |
| 27 | + --model nvidia/parakeet-tdt-0.6b-v3 \\ |
| 28 | + --cluster oci_iad \\ |
| 29 | + --output_dir /lustre/.../parakeet-v3-asr-leaderboard |
| 30 | +
|
| 31 | + # Evaluate canary-qwen-2.5b (SALM model -> salm backend) |
| 32 | + python recipes/asr/run_hf_leaderboard.py \\ |
| 33 | + --model nvidia/canary-qwen-2.5b \\ |
| 34 | + --backend salm \\ |
| 35 | + --cluster oci_iad \\ |
| 36 | + --output_dir /lustre/.../canary-qwen-asr-leaderboard |
| 37 | +""" |
| 38 | + |
| 39 | +import argparse |
| 40 | + |
| 41 | +from nemo_skills.pipeline.cli import eval, wrap_arguments |
| 42 | + |
| 43 | +DEFAULT_SERVER_CONTAINER = "nvcr.io/nvidia/nemo:25.11" |
| 44 | +DEFAULT_INSTALLATION_COMMAND = "pip install -r requirements/audio.txt" |
| 45 | + |
| 46 | + |
| 47 | +def main(): |
| 48 | + parser = argparse.ArgumentParser(description="Run HF Open ASR Leaderboard evaluation on a NeMo ASR model") |
| 49 | + parser.add_argument("--model", required=True, help="NeMo ASR model name or path (e.g. nvidia/canary-qwen-2.5b)") |
| 50 | + parser.add_argument("--cluster", required=True, help="Cluster name (e.g. oci_iad)") |
| 51 | + parser.add_argument("--output_dir", required=True, help="Directory for evaluation outputs") |
| 52 | + parser.add_argument("--data_dir", default="/dataset", help="Root data directory (must contain asr-leaderboard/)") |
| 53 | + parser.add_argument("--server_container", default=DEFAULT_SERVER_CONTAINER, help="NeMo container image") |
| 54 | + parser.add_argument("--server_gpus", type=int, default=1, help="Number of GPUs for the ASR server") |
| 55 | + parser.add_argument( |
| 56 | + "--backend", |
| 57 | + default="nemo_asr", |
| 58 | + choices=["nemo_asr", "salm"], |
| 59 | + help="Server backend: nemo_asr for traditional ASR models (parakeet), salm for SALM models (canary-qwen)", |
| 60 | + ) |
| 61 | + parser.add_argument("--batch_size", type=int, default=16, help="NeMo ASR transcription batch size") |
| 62 | + parser.add_argument( |
| 63 | + "--num_chunks", type=int, default=None, help="Split dataset into N chunks for data parallelism" |
| 64 | + ) |
| 65 | + parser.add_argument("--expname", default="asr-leaderboard", help="Experiment name") |
| 66 | + parser.add_argument("--partition", default=None, help="Slurm partition (e.g. interactive)") |
| 67 | + parser.add_argument("--config_dir", default=None, help="Directory containing cluster config YAMLs") |
| 68 | + parser.add_argument("--split", default=None, help="Dataset split to evaluate (default: test = all datasets)") |
| 69 | + |
| 70 | + args = parser.parse_args() |
| 71 | + |
| 72 | + eval( |
| 73 | + ctx=wrap_arguments( |
| 74 | + "++prompt_format=openai " |
| 75 | + "++prompt_config=null " |
| 76 | + "++enable_audio=true " |
| 77 | + "++server.server_type=vllm_multimodal " |
| 78 | + "++max_concurrent_requests=16 " |
| 79 | + "++inference.tokens_to_generate=256" |
| 80 | + ), |
| 81 | + cluster=args.cluster, |
| 82 | + output_dir=args.output_dir, |
| 83 | + benchmarks="asr-leaderboard", |
| 84 | + model=args.model, |
| 85 | + server_type="generic", |
| 86 | + server_gpus=args.server_gpus, |
| 87 | + server_entrypoint=( |
| 88 | + "MKL_SERVICE_FORCE_INTEL=1 MKL_THREADING_LAYER=GNU " |
| 89 | + "MKL_NUM_THREADS=1 VML_NUM_THREADS=1 " |
| 90 | + "python -m nemo_skills.inference.server.serve_unified" |
| 91 | + ), |
| 92 | + server_args=f"--backend {args.backend} --batch_size {args.batch_size}", |
| 93 | + server_container=args.server_container, |
| 94 | + num_chunks=args.num_chunks, |
| 95 | + data_dir=args.data_dir, |
| 96 | + config_dir=args.config_dir, |
| 97 | + partition=args.partition, |
| 98 | + split=args.split, |
| 99 | + installation_command=DEFAULT_INSTALLATION_COMMAND, |
| 100 | + expname=args.expname, |
| 101 | + ) |
| 102 | + |
| 103 | + |
| 104 | +if __name__ == "__main__": |
| 105 | + main() |
0 commit comments