wikineural-multilingual-ner-onnx

An ONNX export of Babelscape/wikineural-multilingual-ner for named entity recognition (NER). It tags people, organisations, locations and other names (MISC) in text.

Base model Babelscape/wikineural-multilingual-ner
Base revision (inferred) bed6ee7a45d2827b6c90a4fd7983f0241ae0a5c1
ONNX files revision 74191432b21c956b5b04b4778c0e92e569b1f80d
Licence CC BY-NC-SA 4.0 (non-commercial research only)
Used by SqueakyCleanText

How it was exported

The export used SqueakyCleanText's scripts/export_onnx_models.py, first committed the same day, shortly after the upload (commit f9e4a42). That version runs python -m optimum.exporters.onnx --model Babelscape/wikineural-multilingual-ner --task token-classification.

  • Uploaded on 2026-02-23.
  • The script does not pin a base revision, so it exported the base repo's main branch. The base revision above is inferred: it is the last base commit before the upload (2023-05-23), it is still main today, and the parity check below matches it.
  • ONNX opset 18, IR version 8. The graph's producer field says pytorch 2.10.0.
  • Weights are FP32. The script has no quantisation or optimisation step.
  • Device: no --device flag (the exporter default, CPU).
  • Extra export flags: none.
  • Files: model.onnx (709 MB), config.json, tokenizer.json, tokenizer_config.json, special_tokens_map.json.
  • Inputs: input_ids, attention_mask, token_type_ids. Output: logits, one row per token.

Parity check

On 2026-11-17 the ONNX model and the original PyTorch model (revision bed6ee7a45d2) were run on the same fixed sample: 6 sentences, 115 tokens in 6 languages (en, nl, de, es, fr, pt). Each side used its own tokenizer. CPU only, with Python 3.12.15, torch 2.15.0, transformers 4.57.6, onnxruntime 1.32.0 and tokenizers 0.22.2.

Check Result
Token IDs, ONNX tokenizer vs base tokenizer identical
id2label, ONNX config vs base config identical
Same top label for each token 115 / 115
Largest absolute logit difference 9.5e-06

This is a small sample. It shows that the ONNX model matches the original on these inputs. It does not prove a match on every input, and it is not an accuracy score.

How to use it

With SqueakyCleanText

SqueakyCleanText (SCT) loads this model by default, under the key MULTILINGUAL, pinned to revision 74191432b21c956b5b04b4778c0e92e569b1f80d. SCT uses it for French, Portuguese, Italian and every language without a model of its own (together with the English model). It also runs inside the default English, Dutch, German and Spanish ensembles. SCT loads it at start-up, whatever the input language.

# pip install squeakycleantext
from sct import TextCleaner

print(TextCleaner().process("Marie Dupont habite à Lyon et travaille chez Renault.").lm_text)

SCT's own code stays MIT. But SCT's default config runs this model, so using SCT with its defaults means using a non-commercial model. The SCT docs (model licences) show how to run SCT without it.

With onnxruntime

# pip install onnxruntime tokenizers huggingface_hub numpy
import json
import numpy as np
import onnxruntime as ort
from huggingface_hub import snapshot_download
from tokenizers import Tokenizer

path = snapshot_download("rhnfzl/wikineural-multilingual-ner-onnx", revision="74191432b21c956b5b04b4778c0e92e569b1f80d")
tokenizer = Tokenizer.from_file(f"{path}/tokenizer.json")
id2label = json.load(open(f"{path}/config.json"))["id2label"]
session = ort.InferenceSession(f"{path}/model.onnx", providers=["CPUExecutionProvider"])

enc = tokenizer.encode("Marie Dupont habite à Lyon et travaille chez Renault.")
inputs = {"input_ids": [enc.ids], "attention_mask": [enc.attention_mask], "token_type_ids": [enc.type_ids]}
feed = {i.name: np.array(inputs[i.name], dtype=np.int64) for i in session.get_inputs()}
logits = session.run(None, feed)[0][0]
for token, label_id in zip(enc.tokens, logits.argmax(-1)):
    print(token, id2label[str(label_id)])

This prints one label per sub-word token. Group the tokens into entities yourself, or use SqueakyCleanText. Input longer than 512 tokens must be split first.

Labels

From config.json (id2label, in index order): O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISC.

SqueakyCleanText maps PER, ORG, LOC and MISC to <PERSON>, <ORGANISATION>, <LOCATION> and <MISC>.

Limits

  • No accuracy number for this model exists in the SqueakyCleanText benchmarks (checked: everything under benchmarks/results/, up to SCT 0.10.0). SCT's benchmarks score the whole pipeline, where this model runs inside an ensemble, so those numbers are not numbers for this model. For the base model's own scores, see the base model card.
  • This is a format conversion only. It has the same skills, gaps and biases as the base model, which was trained on WikiNEuRal (de, en, es, fr, it, nl, pl, pt, ru). Read the limits section of the base model card too.
  • It knows only the labels above. It does not find e-mail addresses, phone numbers, IDs or other PII types.
  • tokenizer.json truncates input at 512 tokens without an error. In the onnxruntime example, text past that point gets no labels. SCT splits long text into windows first.

Licence

Non-commercial research only. The base model is licensed CC BY-NC-SA 4.0. Its card says: "Contents of this repository are restricted to only non-commercial research purposes under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0). Copyright of the dataset contents and models belongs to the original copyright holders." This ONNX export is a derivative, so the same licence applies: give credit, no commercial use, and share changes under the same licence. The base card limits use to non-commercial research.

Credit for the model goes to the authors of Babelscape/wikineural-multilingual-ner. This repo only changes the file format. If you use this model in your work, cite the base model as its card asks.

Downloads last month
214
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rhnfzl/wikineural-multilingual-ner-onnx

Quantized
(2)
this model

Dataset used to train rhnfzl/wikineural-multilingual-ner-onnx