[CI] Compute speech WER directly with jiwer (#49773)

This commit is contained in:
Chang Guo
2026-07-25 20:51:21 -04:00
committed by GitHub
parent 0111002323
commit 7a6a5b3667
@@ -17,7 +17,7 @@ import pytest
import soundfile
import torch
from datasets import Audio, load_dataset
from evaluate import load
from jiwer import wer
from transformers.models.whisper.english_normalizer import EnglishTextNormalizer
from vllm.benchmarks.datasets.datasets import ASRDataset
@@ -202,8 +202,7 @@ def run_evaluation(
# Compute WER
predictions = [res[2] for res in results]
references = [res[3] for res in results]
wer = load("wer")
wer_score = 100 * wer.compute(references=references, predictions=predictions)
wer_score = 100 * wer(references, predictions)
print("WER:", wer_score)
return wer_score
@@ -302,8 +301,7 @@ def run_longform_evaluation(
predictions = [res[2] for res in results]
references = [res[3] for res in results]
wer = load("wer")
wer_score = 100 * wer.compute(references=references, predictions=predictions)
wer_score = 100 * wer(references, predictions)
print("WER:", wer_score)
return wer_score