mirror of
https://github.com/vllm-project/vllm.git
synced 2026-08-22 13:40:15 +00:00
[Bugfix] Re-enable benchmarking of librispeech dataset. (#47033)
Signed-off-by: Anna Mayne <[email protected]>
This commit is contained in:
@@ -123,15 +123,22 @@ def test_asr_dataset_sample_handles_local_audio_paths(tmp_path: Path) -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_asr_dataset_sample_handles_embedded_audio_bytes(tmp_path: Path) -> None:
|
||||
@pytest.mark.parametrize("has_filepath", [True, False])
|
||||
def test_asr_dataset_sample_handles_embedded_audio_bytes(
|
||||
tmp_path: Path, has_filepath: bool
|
||||
) -> None:
|
||||
audio_path = tmp_path / "earnings.wav"
|
||||
_write_wav(audio_path, duration_s=0.1)
|
||||
|
||||
test_path = None
|
||||
if has_filepath:
|
||||
test_path = audio_path
|
||||
|
||||
dataset = object.__new__(datasets_module.ASRDataset)
|
||||
dataset.data = [
|
||||
{
|
||||
"audio": {
|
||||
"path": None,
|
||||
"path": test_path,
|
||||
"bytes": audio_path.read_bytes(),
|
||||
},
|
||||
"text": "quarterly earnings call",
|
||||
|
||||
@@ -4090,9 +4090,10 @@ class ASRDataset(HuggingFaceDataset):
|
||||
EARNINGS22_TINY_FILTERED_DATASET = (
|
||||
"D4nt3/esb-datasets-earnings22-validation-tiny-filtered"
|
||||
)
|
||||
LIBRISPEECH_DATASET = "openslr/librispeech_asr"
|
||||
|
||||
SUPPORTED_DATASET_PATHS = {
|
||||
"openslr/librispeech_asr",
|
||||
LIBRISPEECH_DATASET,
|
||||
"facebook/voxpopuli",
|
||||
"LIUM/tedlium",
|
||||
"edinburghcstr/ami",
|
||||
@@ -4120,7 +4121,10 @@ class ASRDataset(HuggingFaceDataset):
|
||||
self.data = self.data.shuffle(seed=self.random_seed)
|
||||
self._materialize_local_audio_column()
|
||||
return
|
||||
if self.hf_name == self.EARNINGS22_TINY_FILTERED_DATASET:
|
||||
if self.hf_name in (
|
||||
self.EARNINGS22_TINY_FILTERED_DATASET,
|
||||
self.LIBRISPEECH_DATASET,
|
||||
):
|
||||
super().load_data()
|
||||
self._disable_audio_decode()
|
||||
return
|
||||
@@ -4199,14 +4203,14 @@ class ASRDataset(HuggingFaceDataset):
|
||||
elif isinstance(audio, str):
|
||||
duration_s = sf.info(audio).duration
|
||||
mm_content = {"audio_path": audio}
|
||||
elif isinstance(audio, dict) and audio.get("path"):
|
||||
duration_s = sf.info(audio["path"]).duration
|
||||
mm_content = {"audio_path": audio["path"]}
|
||||
elif isinstance(audio, dict) and audio.get("bytes") is not None:
|
||||
with BytesIO(audio["bytes"]) as audio_buffer:
|
||||
y, sr = sf.read(audio_buffer, dtype="float32")
|
||||
duration_s = get_audio_duration(y=y, sr=sr)
|
||||
mm_content = {"audio": (y, sr)}
|
||||
elif isinstance(audio, dict) and audio.get("path"):
|
||||
duration_s = sf.info(audio["path"]).duration
|
||||
mm_content = {"audio_path": audio["path"]}
|
||||
else:
|
||||
raise ValueError(
|
||||
"ASR samples must provide decoded audio arrays, "
|
||||
|
||||
Reference in New Issue
Block a user