question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Converting wav2vec2-base-960h to ONNX report an error while converting

See original GitHub issue

First 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
patrickvonplatencommented, Jan 14, 2022
3reactions
patrickvonplatencommented, Feb 11, 2021

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 script convert_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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found