Downloads · 30 days
21
58% of all-time downloads
Tazner/Gliner-PII-wo-int8-emb4
Gliner-PII-wo-int8-emb4 is a token classification model from Tazner. Use it when you need labels on individual words, such as names. It is set up for gliner. The card lists the license as other.
A smaller ONNX build of nvidia/gliner-PII: a zero-shot named-entity model for detecting Personally Identifiable Information (PII) and Protected Health Information (PHI) across 55+ categories — give it text plus any la…
Downloads · 30 days
21
58% of all-time downloads
All-time downloads
36
Public
Repo size
607 MB
Likes
1
Public
Click a slice to open those files.
.onnx605 MB · 98%
From the Hugging Face model README
A smaller ONNX build of nvidia/gliner-PII: a
zero-shot named-entity model for detecting Personally Identifiable Information (PII) and
Protected Health Information (PHI) across 55+ categories — give it text plus any label
list you want, and it finds matching spans without being trained on those exact labels
ahead of time.
nvidia/gliner-PII only ships PyTorch weights (1.78 GB, fp32). This repository is that
same model exported to ONNX and quantized down to 577 MB — roughly a third of the
original size.
pip install gliner onnxruntime huggingface_hub
from gliner import GLiNER
model = GLiNER.from_pretrained(
"Tazner/Gliner-PII-wo-int8-emb4",
load_onnx_model=True,
load_tokenizer=True,
onnx_model_file="model.onnx",
)
text = "Hi support, my account username is 'johndoe88'. Reach me at (555) 123-4567 or [email protected]"
labels = ["email", "phone_number", "user_name"]
entities = model.predict_entities(text, labels, threshold=0.5)
for e in entities:
print(e["text"], "->", e["label"], round(e["score"], 2))
The standard way to shrink an ONNX model is dynamic quantization
(onnxruntime.quantization.quantize_dynamic), which compresses both the model's stored
weights and the numbers flowing through it at runtime (activations) down to INT8.
That second part is a known risk here. This model's backbone,
microsoft/deberta-v3-large, uses an
attention mechanism ("disentangled attention") that produces occasional very large
activation values. Squeezing those into INT8's 256 buckets forces the range to stretch to
cover the outliers, crushing ordinary values into a couple of adjacent buckets.
This build instead uses weight-only quantization: only the numbers stored on disk are compressed. Activations stay in full precision the entire time the model runs, which avoids that failure mode by construction. The cost is latency, not accuracy risk — see Trade-offs.
| size | |
|---|---|
Source (pytorch_model.bin, fp32) | 1782 MB |
| ONNX export (fp32, unquantized) | 1702 MB |
| This model | 577 MB |
onnxruntime's weight-only quantizer only
supports 4-bit for Gather ops (the embedding lookup), 8-bit isn't an available option
there.nvidia/gliner-PII (PyTorch, fp32) and exported to ONNX via GLiNER's own
model.export_to_onnx().onnxruntime.quantization.matmul_nbits_quantizer.MatMulNBitsQuantizer, applied directly
to the fp32 export. (An fp32→fp16 pre-conversion was tried first to shrink the
untouched remainder for free, but onnxconverter_common's converter corrupted this
particular graph — deberta-v2's embedding subgraph deliberately upcasts to fp32 in a
couple of spots for numerical stability, and the converter didn't respect that boundary.
Quantizing straight from fp32 sidesteps it.)Gather) → INT4, block-wise, same tool, separate pass (the
quantizer requires 4-bit specifically for Gather ops).Full detail in quantization_manifest.json.
| File | Purpose |
|---|---|
model.onnx | The quantized ONNX graph (INT8 MatMuls, INT4 embeddings) |
spm.model, tokenizer.json, tokenizer_config.json, special_tokens_map.json, added_tokens.json | Tokenizer (unchanged from upstream) |
gliner_config.json | GLiNER model configuration |
quantization_manifest.json | Exact quantization recipe |
LICENSE, NOTICE | NVIDIA Open Model License and required attribution notice |
| Source model | nvidia/gliner-PII, NVIDIA Open Model License |
| GLiNER base | urchade/gliner_large-v2.1 |
| Backbone | microsoft/deberta-v3-large |
| Training data | nvidia/nemotron-pii |
Licensed by NVIDIA Corporation under the NVIDIA Open Model License. See NOTICE.
export_to_onnx().This work is distributed under the NVIDIA Open Model License,
the same license as the source model. A full copy is included as LICENSE in this
repository, along with the required NOTICE file.
Models under this license are commercially usable, and derivative models may be freely created and distributed under the terms of that agreement. This repository does not use NVIDIA's trade names, trademarks, or product names beyond what's needed to describe the origin of the model, as the license permits.