Downloads · 30 days
10
29% of all-time downloads
Genex12/ms-marco-MiniLM-L-6-v2-onnx-cpu-qint8
ms-marco-MiniLM-L-6-v2-onnx-cpu-qint8 is a text ranking model from Genex12. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for onnxruntime. The card lists the license as apache-2.0.
This repository contains a QInt8 ONNX Runtime derivative of cross-encoder/ms-marco-MiniLM-L-6-v2.
Downloads · 30 days
10
29% of all-time downloads
All-time downloads
34
Public
Repo size
23.2 MB
Likes
0
Public
Click a slice to open those files.
.onnx23.2 MB · 96%
From the Hugging Face model README
This repository contains a QInt8 ONNX Runtime derivative of cross-encoder/ms-marco-MiniLM-L-6-v2.
It is intended for CPU inference with ONNX Runtime and keeps the tokenizer/config payload needed to score query-document pairs without the original full-precision model weights.
c5ee24cb16019beea0893ab7796b1df96625c6b8Apache-2.01.22.1QInt8CPUExecutionProvideronnx/model.onnxconfig.jsontokenizer.jsontokenizer_config.jsonspecial_tokens_map.jsonvocab.txtBenchmarked locally on Intel Core i7-9750H (AVX2) with CPUExecutionProvider.
| variant | size (MB) | avg latency (ms) | p95 latency (ms) | throughput (req/s) | pairs/s |
|---|---|---|---|---|---|
| upstream ONNX | 86.80 | 293.09 | 402.45 | 3.41 | 68.24 |
upstream quint8_avx2 | 22.13 | 241.01 | 268.70 | 4.15 | 82.98 |
| this QInt8 repo | 22.11 | 210.12 | 248.74 | 4.76 | 95.18 |
| variant | size (MB) | avg latency (ms) | p95 latency (ms) | throughput (req/s) | pairs/s |
|---|---|---|---|---|---|
| upstream ONNX | 86.80 | 773.54 | 884.32 | 1.29 | 64.64 |
upstream quint8_avx2 | 22.13 | 644.78 | 721.12 | 1.55 | 77.55 |
| this QInt8 repo | 22.11 | 577.89 | 644.01 | 1.73 | 86.52 |
Relative to the upstream ONNX release on this host:
+39.6%+34.1%-74.5%4/52/5import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
repo_id = "temsa/ms-marco-MiniLM-L-6-v2-onnx-cpu-qint8"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model_path = hf_hub_download(repo_id=repo_id, filename="onnx/model.onnx")
session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
query = "how do I renew my driving licence in ireland"
document = "You can renew your driving licence online if you meet the identity requirements."
encoded = tokenizer([[query, document]], return_tensors="np", truncation=True, padding=True, max_length=128)
inputs = {name: value.astype(np.int64) for name, value in encoded.items() if name in {inp.name for inp in session.get_inputs()}}
scores = session.run(None, inputs)[0]
print(scores)