audio icon indicating copy to clipboard operation
audio copied to clipboard

fix bug: matrix multiplication errors caused by discontinuous memory

Open bigcash opened this issue 3 months ago • 4 comments

When reading audio files in large quantities with multiple processes, it sometimes leads to discontinuous memory space for the audio. Then, when calling the fbank method, the continuous method is usually not called to make its stored content space continuous. Furthermore, an exception occurred in the torch.mm within the fbank method, ultimately leading to an unexpected segmentation fault. I ultimately identified this bug and added contigues() to the variables spectrum and mel_deergies. T to avoid this error.

bigcash avatar Sep 25 '25 03:09 bigcash

:link: Helpful Links

:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/audio/4111

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

pytorch-bot[bot] avatar Sep 25 '25 03:09 pytorch-bot[bot]

Hi @bigcash!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

meta-cla[bot] avatar Sep 25 '25 03:09 meta-cla[bot]

Furthermore, an exception occurred in the torch.mm within the fbank method, ultimately leading to an unexpected segmentation fault.

What was the exception and which torch version are you using?

torch.mm is able to handle non-contiguous inputs, for instance:

>>> import torch
>>> a = torch.randn(4, 4)[::2, ::2]
>>> b = torch.randn(4, 4)[::2, ::2]
>>> a.is_contiguous()
False
>>> torch.mm(a, b)
tensor([[ 0.2873, -0.2190],
        [-0.6884, -0.3184]])

pearu avatar Sep 30 '25 15:09 pearu

Furthermore, an exception occurred in the torch.mm within the fbank method, ultimately leading to an unexpected segmentation fault.

What was the exception and which torch version are you using?

torch.mm is able to handle non-contiguous inputs, for instance:

>>> import torch
>>> a = torch.randn(4, 4)[::2, ::2]
>>> b = torch.randn(4, 4)[::2, ::2]
>>> a.is_contiguous()
False
>>> torch.mm(a, b)
tensor([[ 0.2873, -0.2190],
        [-0.6884, -0.3184]])

thanks for reply!

and i make this exception with torch_npu, (not for gpu version) which whill raise this error.

Unfortunately, in this case, it's difficult to modify torch_npu, and easy to modify kaldi.py

bigcash avatar Oct 10 '25 10:10 bigcash