Views
No views yet
onnx/model_quantized.onnx file that quantized runtimes such as transformers.js resolve for
dtype: 'q8' (the upstream repository ships the fp32 export only, so a q8 request 404s there).1from onnxruntime.quantization import QuantType, quantize_dynamic
2quantize_dynamic("onnx/model.onnx", "onnx/model_quantized.onnx", weight_type=QuantType.QUInt8)QUInt8 rather than QInt8: both score identically on the downstream benchmark below, but unsigned
is measurably more faithful to the fp32 reference (mean cosine 0.98817 vs 0.98600 over 438 texts, and
worst case 0.974 vs 0.954), at equal speed on the hosts tested.embeddings.tok_embeddings.weight (98.3M values,
the 256k-token vocabulary table) is already INT8 in the upstream fp32 export, and only the 25.2M float
transformer values are affected. That is why the file shrinks 1.6x (199 MB to 124 MB) rather than the
usual 4x, and why the speedup is ~1.2x rather than 2x.| fp32 | INT8 (this repo) | |
|---|---|---|
| routing commits at equal precision | baseline | within one case |
| out-of-domain gibberish misrouted | 0 | 0 |
1import { pipeline } from '@huggingface/transformers'
2const extract = await pipeline('feature-extraction', 'Nicolassuez/bekko-embedding-v1-a25m-onnx-q8', { dtype: 'q8' })
3const vec = await extract('query text', { pooling: 'mean', normalize: true })