File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1+ av >=14.0.0
12coverage ==7.8.*
23cryptography==42.0.8
34mosaicml-streaming==0.11.0
5+ torchaudio >=2.7.0
46pytest ==8.4.*
57pytest-cov ==6.1.1
68pytest-timeout ==2.3.1
79pytest-rerunfailures ==14.0
810pytest-random-order ==1.1.1
911pandas
12+ pyarrow >=20.0.0
13+ polars >1.0.0
1014lightning
1115transformers <4.53.0
1216zstd
1317numpy < 2.0
18+ s5cmd >=0.2.0
19+ soundfile >=0.13.0 # required for torchaudio backend
Original file line number Diff line number Diff line change 33import random
44import sys
55from functools import partial
6+ from io import BytesIO
67from queue import Empty
78from typing import Any , List
89from unittest import mock
@@ -1146,6 +1147,8 @@ def test_load_torch_audio(tmpdir, compression):
11461147
11471148 import torchaudio
11481149
1150+ torchaudio .set_audio_backend ("soundfile" )
1151+
11491152 optimize (
11501153 fn = create_synthetic_audio_bytes ,
11511154 inputs = list (range (100 )),
@@ -1157,9 +1160,11 @@ def test_load_torch_audio(tmpdir, compression):
11571160
11581161 dataset = StreamingDataset (input_dir = str (tmpdir ))
11591162 sample = dataset [0 ]
1160- tensor = torchaudio .load (sample ["content" ])
1161- assert tensor [0 ].shape == torch .Size ([1 , 16000 ])
1162- assert tensor [1 ] == 16000
1163+ buffer = BytesIO (sample ["content" ])
1164+ buffer .seek (0 )
1165+ tensor , sample_rate = torchaudio .load (buffer , format = "wav" )
1166+ assert tensor .shape == torch .Size ([1 , 16000 ])
1167+ assert sample_rate == 16000
11631168
11641169
11651170def create_synthetic_audio_file (filepath ) -> dict :
You can’t perform that action at this time.
0 commit comments