Skip to content

Commit 70cf50a

Browse files
author
The TensorFlow Datasets Authors
committed
Ensure pydub's fast path for WAV audio by passing format as str, not bytes.
PiperOrigin-RevId: 890691422
1 parent 07610cd commit 70cf50a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tensorflow_datasets/core/features/audio_feature.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def _pydub_decode_audio(
131131
fobj = io.BytesIO(audio_tensor.numpy())
132132
if file_format_tensor.has_value():
133133
file_format = file_format_tensor.get_value().numpy()
134+
if isinstance(file_format, bytes):
135+
file_format = file_format.decode('utf-8')
134136
else:
135137
file_format = None
136138
return _pydub_load_audio(fobj, file_format, channels)

0 commit comments

Comments
 (0)