audio: Exporting the operator stft to ONNX opset version 9 is not supported.
Hi, I try exporting the process of feature extraction to onnx:
import torch
import torchaudio
model = torchaudio.transforms.MelSpectrogram()
x = torch.randn(1, 16000)
torch.onnx.export(model, x, 'tmp.onnx', input_names=['input'], output_names=['output'])
and get:
RuntimeError: Exporting the operator stft to ONNX opset version 9 is not supported. Please open a bug to request ONNX export support for the missing operator.
So will torchaudio add supports operators used in torchaudio.transforms
module in the future? You see that exporting the process of feature extraction and the neural network together will be very convenient.
Thanks!
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 19 (4 by maintainers)
Commits related to this issue
- Merge pull request #982 from yzs981130/fix_batch_size_comment Closes #771. Fix vague description on batch size calculation in imagenet. — committed to mpc001/audio by msaroufim 2 years ago
While we wait for native PyTorch integration, folks can checkout https://github.com/adobe-research/convmelspec which will implement (Mel)spectrograms via 1D conv layer to both ONNX and CoreML (and as a second option CoreML MIL ops).
PR is finally merged. https://github.com/onnx/onnx/pull/3741
Hi, is there any news on this issue? This feature is going to be important for the SpeechBrain project. Some of our contributors are working on exporting our speech processing pipelines into a microcontroller. This requires the model to be ONNX exportable/importable (@fpaissan). The main issue is that all the feature extraction relies on fft and stft.
@chenjiasheng There is actually some good news around : pytorch/pytorch#65666 and onnx/onnx#3741
very cool solution, you guys should publish it to pypi!
These signal processing operators (STFT/FFT/IFFT) are supported in opset 17.
I was trying to export the torch module to ONNX, but I was thrown an error. Does torch need to support this even after MR is being merged in ONNX ?