ONNX Model Zoo

fxmarty/distilbert-base-uncased-finetuned-sst-2-english-int8-static-dedicated-qdq-everywhere

By fxmarty · ↓ 3 · ♥ 0 · Updated 2022-09-26

What's in this repo

This page lists the files in fxmarty/distilbert-base-uncased-finetuned-sst-2-english-int8-static-dedicated-qdq-everywhere, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 10 files, including 4 .json, 2 .png, 1 .md, 1 .onnx, 1 .txt
  • Last updated 2022-09-26

ONNX files

File Size Download
model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

This model is a fork of https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english , quantized using static Post-Training Quantization (PTQ) with ONNX Runtime and 🤗 Optimum library.

It achieves 0.896 accuracy on the validation set.

This model uses the ONNX Runtime static quantization configurations qdq_add_pair_to_weight=True and qdq_dedicated_pair=True, so that weights are stored in fp32, and full Quantize + Dequantize nodes are inserted for the weights, compared to the default where weights are stored in int8 and only a Dequantize node is inserted for weights. Moreover, here QDQ pairs have a single output. For more reference, see the documentation: https://github.com/microsoft/onnxruntime/blob/ade0d291749144e1962884a9cfa736d4e1e80ff8/onnxruntime/python/tools/quantization/quantize.py#L432-L441

This is useful to later load a static quantized model in TensorRT.

To load this model:

from optimum.onnxruntime import ORTModelForSequenceClassification
model = ORTModelForSequenceClassification.from_pretrained("fxmarty/distilbert-base-uncased-finetuned-sst-2-english-int8-static-dedicated-qdq-everywhere")

Weights stored as int8, only DequantizeLinear nodes (model here: https://huggingface.co/fxmarty/distilbert-base-uncased-finetuned-sst-2-english-int8-static)

DQ only

Weights stored as fp32, only QuantizeLinear + DequantizeLinear nodes (this model)

QDQ

Model info

text-classification transformers
transformers onnx distilbert text-classification dataset:sst2 dataset:glue license:apache-2.0 endpoints_compatible region:us
↓ 3 ♥ 0

Created: 2022-09-26

Updated: 2022-09-26

View on Hugging Face

Files (10)

.gitattributes
README.md
config.json
eval_results.json
model.onnx ONNX
no_qdq.png
ort_config.json
qdq.png
tokenizer_config.json
vocab.txt

Related models