Views
No views yet
c5ee24cb16019beea0893ab7796b1df96625c6b8Apache-2.01.22.1QInt8CPUExecutionProvideronnx/model.onnxconfig.jsontokenizer.jsontokenizer_config.jsonspecial_tokens_map.jsonvocab.txtIntel 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 |
+39.6%+34.1%-74.5%4/52/51import numpy as np
2import onnxruntime as ort
3from huggingface_hub import hf_hub_download
4from transformers import AutoTokenizer
5
6repo_id = "temsa/ms-marco-MiniLM-L-6-v2-onnx-cpu-qint8"
7tokenizer = AutoTokenizer.from_pretrained(repo_id)
8model_path = hf_hub_download(repo_id=repo_id, filename="onnx/model.onnx")
9session = ort.InferenceSession(model_path, providers=["CPUExecutionProvider"])
10
11query = "how do I renew my driving licence in ireland"
12document = "You can renew your driving licence online if you meet the identity requirements."
13encoded = tokenizer([[query, document]], return_tensors="np", truncation=True, padding=True, max_length=128)
14inputs = {name: value.astype(np.int64) for name, value in encoded.items() if name in {inp.name for inp in session.get_inputs()}}
15scores = session.run(None, inputs)[0]
16print(scores)