# Error while converting hf model to onnx

**URL:** <https://discuss.huggingface.co/t/error-while-converting-hf-model-to-onnx/10012>\
**Category:** 🤗Transformers\
**Created:** [September 15, 2021, 9:20am UTC](https://discuss.huggingface.co/t/error-while-converting-hf-model-to-onnx/10012 "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](https://discuss.huggingface.co/u/otatopeht)\
**Post date:** [September 15, 2021, 9:20am UTC](https://discuss.huggingface.co/t/error-while-converting-hf-model-to-onnx/10012/1 "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](https://discuss.huggingface.co/u/otatopeht)\
**Post date:** [September 15, 2021, 9:28am UTC](https://discuss.huggingface.co/t/error-while-converting-hf-model-to-onnx/10012/2 "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](https://discuss.huggingface.co/u/baijumeswani)\
**Post date:** [September 20, 2021, 7:26pm UTC](https://discuss.huggingface.co/t/error-while-converting-hf-model-to-onnx/10012/3 "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

```
