ashraq/esc50 forces torchcodec decoding even when Audio(decode=False) is set

#3
by ameenahmed - opened

When loading the dataset ashraq/esc50, attempting to access an audio sample triggers torchcodec even if the Audio column is cast with decode=False.
On environments without torchcodec or with incompatible PyTorch/FFmpeg versions (e.g., Colab default), this prevents dataset usage.

ImportError Traceback (most recent call last)
/tmp/ipython-input-4204499587.py in <cell line: 0>()
3
4 librispeech_dummy = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
----> 5 audio_sample = librispeech_dummy[0]
6
7 model = ClapModel.from_pretrained("laion/clap-htsat-fused").to(0)

9 frames
/usr/local/lib/python3.11/dist-packages/datasets/features/audio.py in decode_example(self, value, token_per_repo_id)
170 from ._torchcodec import AudioDecoder
171 else:
--> 172 raise ImportError("To support decoding audio data, please install 'torchcodec'.")
173
174 if not self.decode:

ImportError: To support decoding audio data, please install 'torchcodec'.


Sign up or log in to comment