fix bug: matrix multiplication errors caused by discontinuous memory#4111
fix bug: matrix multiplication errors caused by discontinuous memory#4111bigcash wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 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. |
|
Hi @bigcash! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
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 |
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.