# Optimizing models using ONNX

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Foptimizing-models-using-onnx%2F1665%3E%5C
**Category:** Models\
**Created:** [October 21, 2020, 6:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Foptimizing-models-using-onnx%2F1665 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fanon45046690)%5C
**Post date:** [October 21, 2020, 6:27am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Foptimizing-models-using-onnx%2F1665%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fvalhalla)%5C
**Post date:** [October 21, 2020, 7:42am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Foptimizing-models-using-onnx%2F1665%2F2 "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.
