Downloads · 30 days
135
14% of all-time downloads
kftof/bge-reranker-v2-m3-onnx-int8-avx2
bge-reranker-v2-m3-onnx-int8-avx2 is a text classification model from kftof. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
ONNX, INT8-quantized build of BAAI/bge-reranker-v2-m3, packaged for Hugging Face Text Embeddings Inference (TEI).
Downloads · 30 days
135
14% of all-time downloads
All-time downloads
994
Public
Repo size
1.2 GB
Likes
2
Public
Click a slice to open those files.
.onnx570 MB · 97%
From the Hugging Face model README
ONNX, INT8-quantized build of BAAI/bge-reranker-v2-m3,
packaged for Hugging Face Text Embeddings Inference (TEI).
Goal: run this reranking cross-encoder on CPU, without AVX-512 or VNNI, with a smaller memory and disk footprint (~0.55 GB vs ~2.3 GB in FP32).
| Setting | Value |
|---|---|
| Tool | 🤗 Optimum (optimum-cli onnxruntime quantize --avx2) |
| Type | Dynamic, IntegerOps / QOperator |
| Weights | QUInt8, symmetric |
| Activations | QUInt8, asymmetric |
per_channel | false |
reduce_range | true |
| Operators | MatMul, Attention, Gather, Transpose, EmbedLayerNormalization, … |
model.onnx size | ~0.55 GB (weights embedded, no .onnx_data file) |
Target hardware: quantized with the AVX2 preset. Intended for x86-64 CPUs that have AVX2 but no AVX-512/VNNI (e.g. AMD Ryzen Zen/Zen+/Zen2 such as the 2600X). The model runs on any x86-64 CPU; the AVX2 preset only tunes the quantization parameters for that instruction profile.
Accuracy note:
reduce_range=Trueis enabled. It keeps INT8 weights on 7 bits to avoid u8×s8 saturation (theVPMADDUBSWinstruction) on AVX2 CPUs without VNNI, as recommended by ONNX Runtime. This trades a negligible amount of headroom for stable accuracy on non-VNNI hardware; on VNNI-capable CPUs it makes no difference.
docker run --rm -p 8080:80 \
ghcr.io/huggingface/text-embeddings-inference:cpu-1.9 \
--model-id kftof/bge-reranker-v2-m3-onnx-int8-avx2
Call the /rerank endpoint:
curl http://127.0.0.1:8080/rerank \
-H 'Content-Type: application/json' \
-d '{
"query": "What is the capital of France?",
"texts": ["Paris is the capital of France.",
"Chocolate cake recipe"]
}'
The response ranks the documents by relevance (highest score first).
pip install "optimum[exporters,onnxruntime]"
optimum-cli export onnx --model BAAI/bge-reranker-v2-m3 \
--task text-classification onnx-fp32
optimum-cli onnxruntime quantize --avx2 --onnx_model onnx-fp32 -o onnx-int8
# then rename onnx-int8/model_quantized.onnx -> model.onnx for TEI
Inherits the upstream license of BAAI/bge-reranker-v2-m3: Apache-2.0.
No re-licensing.