# Optimizing models using ONNX

**URL:** <https://discuss.huggingface.co/t/optimizing-models-using-onnx/1665>\
**Category:** Models\
**Created:** [October 21, 2020, 6:27am UTC](https://discuss.huggingface.co/t/optimizing-models-using-onnx/1665 "2020-10-21T06:27:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon45046690](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@anon45046690](https://discuss.huggingface.co/u/anon45046690)\
**Post date:** [October 21, 2020, 6:27am UTC](https://discuss.huggingface.co/t/optimizing-models-using-onnx/1665/1 "2020-10-21T06:27:49Z")

</div>

I came to know Hugging Face use optimized onnx models for inference on cpu. I tried to do something like that using keras VGGNet16 pretrained model using keras-onnx package ([see this github issue](https://github.com/onnx/keras-onnx/issues/638)) but **couldn’t** see any performance benefits. Can I know how exactly Hugging Face is optimizing models under the hood?

---

<div class="post-metadata">

**Author:** ![valhalla](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/valhalla/32/4179_2.png) [@valhalla](https://discuss.huggingface.co/u/valhalla)\
**Post date:** [October 21, 2020, 7:42am UTC](https://discuss.huggingface.co/t/optimizing-models-using-onnx/1665/2 "2020-10-21T07:42:49Z")

</div>

These two blog posts might help

> **[Accelerate your NLP pipelines using Hugging Face Transformers and ONNX Runtime](https://medium.com/microsoftazure/accelerate-your-nlp-pipelines-using-hugging-face-transformers-and-onnx-runtime-2443578f4333)**
>
> This post was written by Morgan Funtowicz from Hugging Face and Tianlei Wu from Microsoft

> **[Faster and smaller quantized NLP with Hugging Face and ONNX Runtime](https://medium.com/microsoftazure/faster-and-smaller-quantized-nlp-with-hugging-face-and-onnx-runtime-ec5525473bb7)**
>
> Popular Hugging Face Transformer models (BERT, GPT-2, etc) can be shrunk and accelerated with ONNX Runtime quantization without retraining.
