Views
No views yet
MoritzLaurer/DeBERTa-v3-base-mnli-fever-docnli-ling-2c, a DeBERTa-v3-base NLI cross-encoder, packaged for CPU inference with ONNX Runtime.| Subfolder | File | Precision | Size |
|---|---|---|---|
nli-onnx/ | model.onnx | fp32, O3-optimized | ~739 MB |
Why no INT8 build? Dynamic INT8 quantization severely degrades this model — DeBERTa's disentangled-attention ops are quantization-sensitive, and entailment probabilities collapse (e.g. a near-verbatim match drops from ~0.99 to ~0.49). Serve fp32. On CPU this ~184M model runs in tens of milliseconds per pair, so quantization buys little anyway.
softmax(logits)[0].| id | label |
|---|---|
| 0 | entailment |
| 1 | not_entailment |
1import onnxruntime as ort, numpy as np
2from transformers import AutoTokenizer
3
4repo = "Hanno-Labs/DeBERTa-v3-base-mnli-fever-docnli-ling-2c-onnx"
5tok = AutoTokenizer.from_pretrained(repo, subfolder="nli-onnx")
6sess = ort.InferenceSession("nli-onnx/model.onnx", providers=["CPUExecutionProvider"])
7
8enc = tok("A cat sat on the mat.", "There is a cat.", return_tensors="np", truncation=True)
9logits = sess.run(None, {k: v for k, v in enc.items()})[0]
10probs = np.exp(logits) / np.exp(logits).sum(-1, keepdims=True)
11print("entailment prob:", float(probs[0, 0]))optimum.onnxruntime.ORTModelForSequenceClassification.from_pretrained(repo, subfolder="nli-onnx").)1optimum-cli export onnx \
2 --model MoritzLaurer/DeBERTa-v3-base-mnli-fever-docnli-ling-2c \
3 --task text-classification --optimize O3 nli-onnx/Laurer, Moritz, Wouter van Atteveldt, Andreu Salleras Casas, and Kasper Welbers. 2022. Less Annotating, More Classifying – Addressing the Data Scarcity Issue of Supervised Machine Learning with Deep Transfer Learning and BERT - NLI.