# Error while converting hf model to onnx

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-converting-hf-model-to-onnx%2F10012%3E%5C
**Category:** 🤗Transformers\
**Created:** [September 15, 2021, 9:20am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-converting-hf-model-to-onnx%2F10012 "2021-09-15T09:20:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![otatopeht](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@otatopeht](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fotatopeht)%5C
**Post date:** [September 15, 2021, 9:20am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-converting-hf-model-to-onnx%2F10012%2F1 "2021-09-15T09:20:04Z")

</div>

Hi everyone,

I’m converting a finetuned bert model from huggingface to onnx (following this [post](https://huggingface.co/transformers/serialization.html)).

Transformers version: 4.10.2  
When I run this on a terminal

`python -m transformers.onnx --model=/path/to/checkpoint output=/tmp`

I get this error;

```auto
 line 143, in validate_model_outputs
    from onnxruntime import InferenceSession, SessionOptions
ModuleNotFoundError: No module named 'onnxruntime

```

’  
I tried installing onnxruntime-tools but I still get the same error.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![otatopeht](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@otatopeht](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fotatopeht)%5C
**Post date:** [September 15, 2021, 9:28am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-converting-hf-model-to-onnx%2F10012%2F2 "2021-09-15T09:28:32Z")

</div>

The package to install was onnxruntime

---

<div class="post-metadata">

**Author:** ![baijumeswani](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@baijumeswani](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbaijumeswani)%5C
**Post date:** [September 20, 2021, 7:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-while-converting-hf-model-to-onnx%2F10012%2F3 "2021-09-20T19:26:33Z")

</div>

Please refer to [ONNX Runtime | Home](https://onnxruntime.ai/) for more information on installation. The package you’re looking for is `onnxruntime` and can be installed using (for default CPU installation):

```auto
pip install onnxruntime

```

if you’re interested in the onnxruntime for cuda hardware acceleration installation:

```auto
pip install onnxruntime-gpu

```
