load_dataset() in 4.0.0 returns different audio samples compared to earlier versions breaking reproducibility
MEMBER
Hi ! This is because `datasets` now uses the FFmpeg-based library `torchcodec` instead of the libsndfile-based library `soundfile` to decode audio data. Those two have different decoding implementations
2025-07-25T14:27:36Z
https://github.com/huggingface/datasets/issues/7696#issuecomment-3118059961
https://api.github.com/repos/huggingface/datasets/issues/7696
IC_kwDODunzps652dG5
https://api.github.com/repos/huggingface/datasets/issues/comments/3118059961/reactions
2025-07-25T14:27:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/3118059961
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
NONE
I’m all for torchcodec, good luck with the migration!
2025-07-30T14:22:18Z
https://github.com/huggingface/datasets/issues/7696#issuecomment-3136587542
https://api.github.com/repos/huggingface/datasets/issues/7696
IC_kwDODunzps669IcW
https://api.github.com/repos/huggingface/datasets/issues/comments/3136587542/reactions
2025-07-30T14:22:18Z
https://api.github.com/repos/huggingface/datasets/issues/comments/3136587542
https://avatars.githubusercontent.com/u/25346345?v=4
https://api.github.com/users/Manalelaidouni/events{/privacy}
https://api.github.com/users/Manalelaidouni/followers
https://api.github.com/users/Manalelaidouni/following{/other_user}
https://api.github.com/users/Manalelaidouni/gists{/gist_id}
https://github.com/Manalelaidouni
Manalelaidouni
MDQ6VXNlcjI1MzQ2MzQ1
https://api.github.com/users/Manalelaidouni/orgs
https://api.github.com/users/Manalelaidouni/received_events
https://api.github.com/users/Manalelaidouni/repos
https://api.github.com/users/Manalelaidouni/starred{/owner}{/repo}
https://api.github.com/users/Manalelaidouni/subscriptions
User
https://api.github.com/users/Manalelaidouni
public
### Describe the bug

In datasets 4.0.0 release, `load_dataset()` returns different audio samples compared to earlier versions, this breaks integration tests that depend on consistent sample data across different environments (first and second envs specified below).



### Steps to reproduce the bug

```python
from datasets import Audio, load_dataset

ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
ds = ds.cast_column("audio", Audio(24000))
sample= ds[0]["audio"]["array"]
print(sample)

# sample in 3.6.0 
[0.00231914 0.00245417 0.00187414 ... 0.00061956 0.00101157 0.00076325]


# sample in 4.0.0 
array([0.00238037, 0.00220794, 0.00198703, ..., 0.00057983, 0.00085863,
       0.00115309], dtype=float32)
```

### Expected behavior

The same dataset should load identical samples across versions to maintain reproducibility.

### Environment info

First env:
- datasets version: 3.6.0
- Platform: Windows-10-10.0.26100-SP0
- Python: 3.11.0

Second env:
- datasets  version: 4.0.0
- Platform: Linux-6.1.123+-x86_64-with-glibc2.35
- Python: 3.11.13