# Exporting wav2vec model to ONNX

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexporting-wav2vec-model-to-onnx%2F6695%3E%5C
**Category:** Beginners\
**Created:** [June 10, 2021, 1:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexporting-wav2vec-model-to-onnx%2F6695 "2021-06-10T13:36:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darkcurrent](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@darkcurrent](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdarkcurrent)%5C
**Post date:** [June 10, 2021, 1:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexporting-wav2vec-model-to-onnx%2F6695%2F1 "2021-06-10T13:36:32Z")

</div>

Hello,

I am trying to export a wav2vec model _(cahya/wav2vec2-base-turkish-artificial-cv)_ to ONNX format with [convert\_graph\_to\_onnx.py](https://github.com/huggingface/transformers/blob/master/src/transformers/convert_graph_to_onnx.py) script provided in transformers repository.

When I try to use these script with this line:  
`python convert_graph_to_onnx.py --framework pt --model cahya/wav2vec2-base-turkish-artificial-cv exported_model.onnx`

I am getting this error:

```auto
====== Converting model to ONNX ======
ONNX opset version set to: 11
Loading pipeline (model: cahya/wav2vec2-base-turkish-artificial-cv, tokenizer: cahya/wav2vec2-base-turkish-artificial-cv)
Some weights of the model checkpoint at cahya/wav2vec2-base-turkish-artificial-cv were not used when initializing Wav2Vec2Model: ['lm_head.bias', 'lm_head.weight']
- This IS expected if you are initializing Wav2Vec2Model from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing Wav2Vec2Model from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Error while converting the model: __init__ () got an unexpected keyword argument 'feature_extractor'

```

All I understand is that this script is not made for specifically wav2vec models. If I am right, how can I convert the wav2vec model to ONNX format?

---

<div class="post-metadata">

**Author:** ![gondiss](https://avatars.discourse-cdn.com/v4/letter/g/e47c2d/32.png) [@gondiss](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fgondiss)%5C
**Post date:** [June 13, 2021, 6:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexporting-wav2vec-model-to-onnx%2F6695%2F2 "2021-06-13T18:53:38Z")

</div>

Hi,

Were you able to get this working? I am running into the same issue.

---

<div class="post-metadata">

**Author:** ![patrickvonplaten](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/patrickvonplaten/32/2171_2.png) [@patrickvonplaten](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fpatrickvonplaten)%5C
**Post date:** [January 14, 2022, 11:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fexporting-wav2vec-model-to-onnx%2F6695%2F3 "2022-01-14T11:45:03Z")

</div>

Maybe this helps: [Converting wav2vec2-base-960h to ONNX report an error while converting · Issue #10004 · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/issues/10004)
