MultiCoNER/multiconer_v2
Viewer • Updated • 2.71M • 1.58k • 19
How to use Rishabh157/multiconer-multilingual-ner-mdeberta with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="Rishabh157/multiconer-multilingual-ner-mdeberta") # Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Rishabh157/multiconer-multilingual-ner-mdeberta")
model = AutoModelForTokenClassification.from_pretrained("Rishabh157/multiconer-multilingual-ner-mdeberta", device_map="auto")This model is a fine-grained Multilingual Named Entity Recognition (NER) model fine-tuned on the prestigious MultiCoNER 2023 (v2) benchmark suite across 12+ languages.
Built on top of microsoft/mdeberta-v3-base, it targets complex, fine-grained entities in noisy, low-context, and short text domains across 33 fine-grained categories (67 BIO output logits).
Developed by Rishabh Kumar.
microsoft/mdeberta-v3-base (278M parameters, 12 layers, 768 hidden size, 250k multilingual vocabulary)query_proj, key_proj, value_proj, intermediate.dense, output.dense) merged into standalone base weights.torch.float16, ~530 MB footprint)en), Spanish (es), French (fr), German (de), Italian (it), Portuguese (pt), Swedish (sv), Ukrainian (uk), Chinese (zh), Bengali (bn), Hindi (hi), Farsi (fa), and multilingual mixed (MULTI).MultiCoNER/multiconer_v2).<token> <tag>), stripping metadata headers (# and -DOCSTART-) with blank lines preserving sentence boundaries.mDeBERTa-v3-base SentencePiece subword tokenization (add_prefix_space=True). The ground-truth BIO entity label is assigned to the initial subword token of each word, while trailing subword tokens receive -100 PyTorch cross-entropy masking to ensure entity-level evaluation.id_to_label.json and label_to_id.json) directly during preprocessing.The MultiCoNER v2 taxonomy focuses on granular subtypes across six major super-types:
| Super-Type | Fine-Grained Entity Classes |
|---|---|
Person (PER) |
Artist, Athlete, Cleric, Politician, Scientist, SportsManager, OtherPER |
Organization (ORG) |
AerospaceManufacturer, CarManufacturer, MusicalGRP, PrivateCorp, PublicCorp, SportsGRP, ORG |
Location (LOC) |
Facility, HumanSettlement, Station, OtherLOC |
Products & Creative Works (PROD) |
ArtWork, MusicalWork, VisualWork, WrittenWork, Software, Clothing, Drink, Food, Vehicle, OtherPROD |
Medical & Health (MED) |
AnatomicalStructure, Disease, MedicalProcedure, Medication/Vaccine, Symptom |
The model was fine-tuned for 5 epochs (~53.3k steps) using AdamW (lr=2e-5, linear scheduler, effective batch size 16).
| Metric | Score |
|---|---|
| Validation Entity F1 | 0.4839 |
| Validation Precision | 0.4732 |
| Validation Recall | 0.4951 |
| Validation Accuracy | 0.8951 |
| Validation Loss | 0.2616 |
| Epoch | Step | Precision | Recall | Entity F1 | Accuracy | Loss |
|---|---|---|---|---|---|---|
| 1 | 10,677 | 31.71% | 33.66% | 32.65% | 86.91% | 0.3790 |
| 2 | 21,354 | 40.54% | 44.28% | 42.33% | 88.13% | 0.2995 |
| 3 | 32,031 | 44.67% | 45.80% | 45.23% | 88.93% | 0.2764 |
| 4 | 42,708 | 46.89% | 49.05% | 47.94% | 89.45% | 0.2670 |
| 5 | 53,385 | 47.32% | 49.51% | 48.39% | 89.51% | 0.2616 |
from transformers import pipeline
ner = pipeline(
"token-classification",
model="Rishabh157/multiconer-multilingual-ner-mdeberta",
aggregation_strategy="simple"
)
text = "The European Space Agency launched the Ariane 5 rocket from Kourou."
entities = ner(text)
for entity in entities:
print(f"{entity['word']:<25} | {entity['entity_group']:<20} | Score: {entity['score']:.4f}")
import torch
from transformers import AutoTokenizer, AutoModelForTokenClassification
model_name = "Rishabh157/multiconer-multilingual-ner-mdeberta"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)
text = "El Real Madrid ganó la final de la UEFA Champions League en París."
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=2)
tokens = tokenizer.convert_ids_to_tokens(inputs["input_ids"][0])
labels = [model.config.id2label[p.item()] for p in predictions[0]]
for token, label in zip(tokens, labels):
if label != "O":
print(f"{token:<20} -> {label}")
@misc{kumar2026multiconer,
author = {Rishabh Kumar},
title = {MultiCoNER 2023 Fine-Grained Multilingual NER with mDeBERTa-v3},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Rishabh157/multiconer-multilingual-ner-mdeberta}}
}
Base model
microsoft/mdeberta-v3-base