Converting wav2vec2-base-960h to ONNX report an error while converting
See original GitHub issueFirst of all, I want to say thanks to @patrickvonplaten for the work done in adding the model. Great job!
I tried to convert the model to ONNX but got an error, do you have any ideas how to fix it?
What I did:
python -m transformers.convert_graph_to_onnx --framework pt --model facebook/wav2vec2-base-960h wav2vec2-base-960h.onnx
But got an error:
ONNX opset version set to: 11
Loading pipeline (model: facebook/wav2vec2-base-960h, tokenizer: facebook/wav2vec2-base-960h)
Using framework PyTorch: 1.7.0
Error while converting the model: Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' 'truncation=True' to have batched tensors with the same length.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Exporting wav2vec model to ONNX - Beginners
Hello, I am trying to export a wav2vec model (cahya/wav2vec2-base-turkish-artificial-cv) to ONNX format with convert_graph_to_onnx.py script ...
Read more >Deep Learning Toolbox Converter for ONNX Model Format
Deep Learning Toolbox Converter for ONNX Model Format ... Import and export ONNX™ models within MATLAB for interoperability with other deep learning ...
Read more >Compare Methods for Converting and Optimizing ...
In this report, we're going to walk through how to convert trained PyTorch and Keras models to slimmer, leaner models for deployment.
Read more >Converting an ONNX Model - OpenVINO™ Documentation
This page provides instructions on how to convert a model from the ONNX format to the OpenVINO IR format using Model Optimizer. To...
Read more >FAQ (Frequently Asked Questions)
How do I know if the ONNX model I have will run with Windows ML? · How do I convert a model of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @OthmaneJ,
Think @ccoreilly managed to get it to work here: https://github.com/ccoreilly/wav2vec2-service/blob/master/convert_torch_to_onnx.py
Hmm, Wav2Vec2 is still a very recent addition and I don’t have a good idea on an ETA for full ONNX support. However, I think your error above is due to the input that’s passed to
Wav2Vec2Tokenizer
being a string instead of a speech input. So in order to make the conversion work, you will have to tweak the scriptconvert_graph_to_onnx
yourself a bit for Wav2Vec2 - I think the only different should be that instead of passing it"This is a sample output"
you should pass it a 1D float array.