XCiT-Tiny-12/P8 Kenosis: 81.2% ImageNet in 8.4 MB

XCiT-Tiny-12/P8 (timm/xcit_tiny_12_p8_224.fb_dist_in1k, Apache-2.0), made smaller and faster on CPU by Kenosis while keeping accuracy near the original. 81.16% top-1 from a single 8.37 MB standard .onnx file. The same file runs on CPU in both ONNX Runtime and OpenVINO. Calibrated on 128 images, with no retraining.

Accuracy

ImageNet-1K validation, 49,872 images (disjoint from the 128 calibration images), top-1.

model ONNX Runtime OpenVINO size
Original 81.218% 81.218% 27.0 MB
Kenosis 81.158% 81.158% 8.37 MB

Speed

Median time per image over 60 runs, on a CPU with AVX-VNNI.

runtime threads Original Kenosis
ONNX Runtime 1 131.5 ms 96.4 ms
ONNX Runtime 4 58.8 ms 51.6 ms
OpenVINO 1 88.5 ms 49.4 ms
OpenVINO 4 25.7 ms 15.1 ms

Run

from huggingface_hub import hf_hub_download
import numpy as np
import onnxruntime as ort
from PIL import Image

model_path = hf_hub_download("CoreEpoch/xcit-tiny12-p8-int8-imagenet", "xcit_tiny12_p8_224_int8_kenosis.onnx")
sess = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
img = Image.open("your_image.jpg").convert("RGB")
scale = 224 / min(img.size)  # shorter side to 224, center crop: measured transform
img = img.resize((round(img.width*scale), round(img.height*scale)), Image.BICUBIC)
l, t = (img.width-224)//2, (img.height-224)//2
img = img.crop((l, t, l+224, t+224))
x = (np.asarray(img, np.float32)/255.0 - [0.485,0.456,0.406]) / [0.229,0.224,0.225]
logits = sess.run(None, {"input": x.transpose(2,0,1)[None].astype(np.float32)})[0]
print(int(np.argmax(logits)))

Input 1x3x224x224, RGB, /255, ImageNet mean/std. Output logits [1,1000], sorted-synset order.

Integrity & license

xcit_tiny12_p8_224_int8_kenosis.onnx (8,369,008 B), SHA-256 F7D3DCEFA2F4D5C2BC80548B380AB7379C09CEAEBBFA00776073FE72A0F83C7C. Apache-2.0 (base XCiT, Facebook / Meta AI, El-Nouby et al. 2021, retained). The license covers these model files only; it grants no rights in Kenosis, Core Epoch's quantizer, which remains proprietary.

Benchmarks and contact: coreepoch.dev/kenosis · contact@coreepoch.dev

Downloads last month
62
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for CoreEpoch/xcit-tiny12-p8-int8-imagenet

Quantized
(1)
this model

Dataset used to train CoreEpoch/xcit-tiny12-p8-int8-imagenet