unimelb-nlp/wikiann
Viewer • Updated • 2M • 44.5k • 121
How to use davanstrien/numind_generic-entity_recognition_NER-multilingual-v1_wikiann_de with SpanMarker:
from span_marker import SpanMarkerModel
model = SpanMarkerModel.from_pretrained("davanstrien/numind_generic-entity_recognition_NER-multilingual-v1_wikiann_de")This is a SpanMarker model trained on the wikiann dataset that can be used for Named Entity Recognition. This SpanMarker model uses numind/generic-entity_recognition_NER-multilingual-v1 as the underlying encoder.
| Label | Examples |
|---|---|
| LOC | "Savoyer Voralpen", "Bagan", "Zechin" |
| ORG | "NHL Entry Draft", "SKA Sankt Petersburg", "Minnesota Wild" |
| PER | "Antonina Wladimirowna Kriwoschapka", "Lou Salomé", "Jaan Kirsipuu" |
| Label | Precision | Recall | F1 |
|---|---|---|---|
| all | 0.9070 | 0.9070 | 0.9070 |
| LOC | 0.9036 | 0.9298 | 0.9165 |
| ORG | 0.8638 | 0.8446 | 0.8541 |
| PER | 0.9507 | 0.9405 | 0.9455 |
from span_marker import SpanMarkerModel
# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("span_marker_model_id")
# Run inference
entities = model.predict("Sein Bundesliga-Debüt gab der Angreifer am 23.")
You can finetune this model on your own dataset.
from span_marker import SpanMarkerModel, Trainer
# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("span_marker_model_id")
# Specify a Dataset with "tokens" and "ner_tag" columns
dataset = load_dataset("conll2003") # For example CoNLL2003
# Initialize a Trainer using the pretrained model & dataset
trainer = Trainer(
model=model,
train_dataset=dataset["train"],
eval_dataset=dataset["validation"],
)
trainer.train()
trainer.save_model("span_marker_model_id-finetuned")
| Training set | Min | Median | Max |
|---|---|---|---|
| Sentence length | 1 | 9.7693 | 85 |
| Entities per sentence | 1 | 1.3821 | 20 |
| Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
|---|---|---|---|---|---|---|
| 1.2658 | 200 | 0.0172 | 0.8842 | 0.8534 | 0.8686 | 0.9586 |
| 2.5316 | 400 | 0.0145 | 0.8977 | 0.8889 | 0.8933 | 0.9670 |
| 3.7975 | 600 | 0.0161 | 0.8962 | 0.9006 | 0.8984 | 0.9688 |
| 5.0633 | 800 | 0.0180 | 0.8982 | 0.8996 | 0.8989 | 0.9689 |
| 6.3291 | 1000 | 0.0201 | 0.9014 | 0.9008 | 0.9011 | 0.9694 |
| 7.5949 | 1200 | 0.0201 | 0.9010 | 0.9057 | 0.9033 | 0.9702 |
| 8.8608 | 1400 | 0.0217 | 0.9062 | 0.9036 | 0.9049 | 0.9702 |
@software{Aarsen_SpanMarker,
author = {Aarsen, Tom},
license = {Apache-2.0},
title = {{SpanMarker for Named Entity Recognition}},
url = {https://github.com/tomaarsen/SpanMarkerNER}
}
Base model
numind/NuNER-multilingual-v0.1