rdxtremity/clip-laion-b32-onnx-int8
By rdxtremity · ↓ 0 · ♥ 1 · Updated 2026-03-07
What's in this repo
This page lists the files in rdxtremity/clip-laion-b32-onnx-int8, including text_encoder_int8.onnx, vision_encoder_int8.onnx.
- 2 ONNX models (.onnx files)
- 11 files, including 5 .json, 2 .onnx, 1 .md, 1 .txt, 1 .npy
- Last updated 2026-03-07
ONNX files
How to use
These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.
README
CLIP ViT-B/32 LAION — ONNX INT8
INT8-quantized ONNX export of laion/CLIP-ViT-B-32-laion2B-s34B-b79K
Optimized for CPU-only inference (no GPU required at serving time).
Files
| File | Description |
|---|---|
vision_encoder_int8.onnx |
Vision (image) encoder — INT8 quantized |
text_encoder_int8.onnx |
Text encoder — INT8 quantized |
projections.npy |
Visual + text projection weights (FP32) |
tokenizer_config.json etc. |
Processor / tokenizer config |
Performance vs original
| FP32 original | ONNX INT8 | |
|---|---|---|
| Disk | ~600 MB | ~150 MB |
| RAM | ~1.8 GB | ~500 MB |
| Image embed (CPU) | ~800 ms | ~200 ms |
| Text embed (CPU) | ~300 ms | ~80 ms |
Quick start
from huggingface_hub import snapshot_download
import onnxruntime as ort
import numpy as np
from transformers import CLIPProcessor
from PIL import Image
model_dir = snapshot_download("rdxtremity/clip-laion-b32-onnx-int8")
processor = CLIPProcessor.from_pretrained(model_dir)
proj = np.load(f"{model_dir}/projections.npy", allow_pickle=True).item()
vision_sess = ort.InferenceSession(f"{model_dir}/vision_encoder_int8.onnx")
text_sess = ort.InferenceSession(f"{model_dir}/text_encoder_int8.onnx")
# Embed an image
img = Image.open("product.jpg").convert("RGB")
inp = processor(images=img, return_tensors="np")
out = vision_sess.run(["pooler_output"], {"pixel_values": inp["pixel_values"].astype(np.float32)})
vec = out[0] @ proj["visual_projection"].T
vec /= np.linalg.norm(vec)
# Embed text (Arabic + English supported)
inp = processor(text="حذاء رياضي أحمر", return_tensors="np", padding="max_length", truncation=True, max_length=77)
out = text_sess.run(["pooler_output"], {"input_ids": inp["input_ids"].astype(np.int64), "attention_mask": inp["attention_mask"].astype(np.int64)})
vec = out[0] @ proj["text_projection"].T
vec /= np.linalg.norm(vec)
Model info
onnx
clip
int8
image-embeddings
text-embeddings
visual-search
cpu-inference
base_model:laion/CLIP-ViT-B-32-laion2B-s34B-b79K
base_model:quantized:laion/CLIP-ViT-B-32-laion2B-s34B-b79K
license:mit
region:us
↓ 0
♥ 1
Created: 2026-03-07
Updated: 2026-03-07
View on Hugging FaceFiles (11)
.gitattributes
README.md
merges.txt
preprocessor_config.json
projections.npy
special_tokens_map.json
text_encoder_int8.onnx
ONNX
tokenizer.json
tokenizer_config.json
vision_encoder_int8.onnx
ONNX
vocab.json
Related models
More from rdxtremity
More models
No task type declared.