# How to quantize and run inference for CLIP using optimum

**URL:** <https://discuss.huggingface.co/t/how-to-quantize-and-run-inference-for-clip-using-optimum/89631>\
**Category:** 🤗Optimum\
**Created:** [May 31, 2024, 4:38pm UTC](https://discuss.huggingface.co/t/how-to-quantize-and-run-inference-for-clip-using-optimum/89631 "2024-05-31T16:38:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kechan](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@kechan](https://discuss.huggingface.co/u/kechan)\
**Post date:** [May 31, 2024, 4:38pm UTC](https://discuss.huggingface.co/t/how-to-quantize-and-run-inference-for-clip-using-optimum/89631/1 "2024-05-31T16:38:33Z")

</div>

I exported a clip model to ONNX using:

optimum-cli export onnx -m laion/CLIP-ViT-L-14-laion2B-s32B-b82K --framework pt clip\_onnx

And I further tried to quantize it by:

optimum-cli onnxruntime quantize --onnx\_model clip\_onnx/ --arm64 -o quantized\_clip\_onnx

however, I am not sure how to run inference using my quantized\_clip\_onnx

Most code sample started from something like:

ORTModelForSequenceClassification.from\_pretrained(…)

however, there doesnt seem to exist an ORTModel\*\*\* for CLIP related family of models. I am wondering if anyone has succeeded and point me out to a solution.

Thanks.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](https://discuss.huggingface.co/u/nielsr)\
**Post date:** [June 3, 2024, 1:17pm UTC](https://discuss.huggingface.co/t/how-to-quantize-and-run-inference-for-clip-using-optimum/89631/2 "2024-06-03T13:17:20Z")

</div>

cc @merve who worked on Optimum
