Floating point exception (core dumped) on torchaudio.load
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 799
- Avg merge
- 58m
- Merged PRs (30d)
- 3
Description
🐛 Describe the bug
I also encountered the same problem as 2870, which caused a Floating point exception (core dumped) when loading ADPCM encoded audio and caused the service to crash directly.
This problem will occur in torchaudio version 0.11.0 and all versions after, while previous versions are normal.
This is because 0.11.0 fixed a bug about reading 24bit audio at that time 2084, the fixed code is as follows
torchaudio/csrc/pybind/sox/effects_chain.cpp
if (sf->encoding.bits_per_sample > 0)
*osamp /= (sf->encoding.bits_per_sample / 8);
If the bits_per_sample of the audio is less than 8 (as is the case with ADPCM encoded audio), this line of code will directly cause an exception to divide by zero
Versions
Collecting environment information...
PyTorch version: 1.13.0+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35
Python version: 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA GeForce RTX 3060 Ti
GPU 1: NVIDIA GeForce RTX 3080 Ti
Nvidia driver version: 510.85.02
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] numpy==1.23.4
[pip3] pytorch-lightning==1.6.5
[pip3] pytorch-metric-learning==1.6.2
[pip3] torch==1.13.0
[pip3] torch-audiomentations==0.11.0
[pip3] torch-pitch-shift==1.2.2
[pip3] torchaudio==0.13.0
[pip3] torchmetrics==0.10.2
[pip3] torchvision==0.14.0
[conda] Could not collect
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read torchaudio/csrc/pybind/sox/effects_chain.cpp at the shown bits_per_sample calculation, then reproduce torchaudio.load with ADPCM-encoded audio. Confirm that the change prevents the floating point exception while preserving the 24-bit audio behavior described in pull request 2084.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python, pytorch
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100