Indic NER (MuRIL / Naamapadam) — ONNX, int8
An ONNX build of vaibhav006/indic-ner-muril-naamapadam,
which fine-tunes MuRIL on
Naamapadam. Both are Apache-2.0.
Published because no ONNX build of an Indic NER model existed that was both usable and licensed. It
is used by an in-process .NET recognizer (Microsoft.ML.OnnxRuntime + BertTokenizer), so the point
of it is to need no Python and no inference server at runtime.
Files
| file | size | notes |
|---|---|---|
model.onnx |
~227 MB | int8, dynamically quantized per channel |
vocab.txt |
~3.1 MB | regenerated so that line number == token id — see below |
config.json |
<1 KB | carries id2label; 7 labels, B-/I- × PER/ORG/LOC plus O |
Changes from the base model
Apache-2.0 asks that modifications be stated. There are three, and two of them will silently produce a broken model if reproduced carelessly.
1. Exported to ONNX with optimum-cli export onnx --task token-classification. The exporter
reports a maximum absolute logit difference of ~2e-4 against the PyTorch reference, above its 1e-5
tolerance but far below anything that changes a predicted label.
2. Quantized per channel, not per tensor. This is not a tuning preference. MuRIL's embedding
table is 197,285 × 768 and dominates the model; quantized per tensor, a handful of outlier rows set a
single scale and the remaining rows collapse toward zero. The result loads, runs, and labels every
token O with near-identical logits whatever the input — which reads as a bad model rather than a
bad export, and the PyTorch weights are fine. --per_channel gives each row its own scale and
reproduces the float predictions exactly on our probes.
3. vocab.txt regenerated from tokenizer.json with its holes filled. The base vocabulary
defines 197,258 tokens across an id space of 0–197,284: 27 ids have no token. transformers
warns about this when saving (OrderedVocab ... contains holes ... your vocabulary could be corrupted). Written out in sorted order, every id from 202 upward shifts down by one and the whole
corpus is silently mistokenized. Here each hole is filled with an [unused<id>] placeholder that
cannot match real text, so line number equals token id and a plain WordPiece vocabulary file is
correct.
Tokenizer settings
Inherited from MuRIL and load-bearing: cased, and accents not stripped
(do_lower_case: false, strip_accents: false). Devanagari vowel signs are letters rather than
accents — strip them and दिल्ली becomes दिलली, which is a different word.
One caveat for non-Python consumers: a BERT pre-tokenizer that splits on "not a letter or digit" will
cut words at every combining mark, because a mark is neither. दिल्ली arrives at WordPiece as the
fragments द and लल and matches nothing. Word characters must include \p{M}.
Labels
B-LOC B-ORG B-PER I-LOC I-ORG I-PER O — ids 0–6, per config.json.
Aggregate word pieces to word level (a ## continuation inherits the first piece's label). Read per
token, a model that re-opens with B- on a continuing piece will return half a name.
Calibration
Flatter than an English CoNLL model's. Over 200 Hindi headlines it produced nothing above 0.90, and only 26 of 294 mentions above 0.75 — while the 0.60–0.75 band held दिल्ली, मुंबई, पाकिस्तान, पंजाब, श्रीलंका and कांग्रेस, all correct. A threshold carried over from an English model will discard most of what this one gets right. Below about 0.60 the spans stay largely correct but the types degrade first.
- Downloads last month
- 19
Model tree for theanugrah/muril-indic-ner
Base model
google/muril-base-cased