|
--- |
|
language: en |
|
license: cc-by-sa-4.0 |
|
library_name: span-marker |
|
tags: |
|
- span-marker |
|
- token-classification |
|
- ner |
|
- named-entity-recognition |
|
- generated_from_span_marker_trainer |
|
datasets: |
|
- DFKI-SLT/few-nerd |
|
metrics: |
|
- precision |
|
- recall |
|
- f1 |
|
widget: |
|
- text: The WPC led the international peace movement in the decade after the Second |
|
World War, but its failure to speak out against the Soviet suppression of the |
|
1956 Hungarian uprising and the resumption of Soviet nuclear tests in 1961 marginalised |
|
it, and in the 1960s it was eclipsed by the newer, non-aligned peace organizations |
|
like the Campaign for Nuclear Disarmament. |
|
- text: Most of the Steven Seagal movie "Under Siege "(co-starring Tommy Lee Jones) |
|
was filmed on the, which is docked on Mobile Bay at Battleship Memorial Park and |
|
open to the public. |
|
- text: 'The Central African CFA franc (French: "franc CFA "or simply "franc ", ISO |
|
4217 code: XAF) is the currency of six independent states in Central Africa: Cameroon, |
|
Central African Republic, Chad, Republic of the Congo, Equatorial Guinea and Gabon.' |
|
- text: Brenner conducted post-doctoral research at Brandeis University with Gregory |
|
Petsko and then took his first academic position at Thomas Jefferson University |
|
in 1996, moving to Dartmouth Medical School in 2003, where he served as Associate |
|
Director for Basic Sciences at Norris Cotton Cancer Center. |
|
- text: On Friday, October 27, 2017, the Senate of Spain (Senado) voted 214 to 47 |
|
to invoke Article 155 of the Spanish Constitution over Catalonia after the Catalan |
|
Parliament declared the independence. |
|
pipeline_tag: token-classification |
|
base_model: numind/generic-entity_recognition_NER-v1 |
|
model-index: |
|
- name: SpanMarker with numind/generic-entity_recognition-v1 on FewNERD |
|
results: |
|
- task: |
|
type: token-classification |
|
name: Named Entity Recognition |
|
dataset: |
|
name: FewNERD |
|
type: DFKI-SLT/few-nerd |
|
split: eval |
|
metrics: |
|
- type: f1 |
|
value: 0.7039859923782059 |
|
name: F1 |
|
- type: precision |
|
value: 0.7047408904377952 |
|
name: Precision |
|
- type: recall |
|
value: 0.7032327098380559 |
|
name: Recall |
|
--- |
|
|
|
# SpanMarker with numind/generic-entity_recognition-v1 on FewNERD |
|
|
|
This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model trained on the [FewNERD](https://huggingface.co/datasets/DFKI-SLT/few-nerd) dataset that can be used for Named Entity Recognition. This SpanMarker model uses [numind/generic-entity_recognition_NER-v1](https://huggingface.co/numind/generic-entity_recognition_NER-v1) as the underlying encoder. |
|
|
|
## Model Details |
|
|
|
### Model Description |
|
- **Model Type:** SpanMarker |
|
- **Encoder:** [numind/generic-entity_recognition_NER-v1](https://huggingface.co/numind/generic-entity_recognition_NER-v1) |
|
- **Maximum Sequence Length:** 256 tokens |
|
- **Maximum Entity Length:** 8 words |
|
- **Training Dataset:** [FewNERD](https://huggingface.co/datasets/DFKI-SLT/few-nerd) |
|
- **Language:** en |
|
- **License:** cc-by-sa-4.0 |
|
|
|
### Model Sources |
|
|
|
- **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER) |
|
- **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf) |
|
|
|
### Model Labels |
|
| Label | Examples | |
|
|:-----------------------------------------|:---------------------------------------------------------------------------------------------------------| |
|
| art-broadcastprogram | "Corazones", "The Gale Storm Show : Oh , Susanna", "Street Cents" | |
|
| art-film | "Shawshank Redemption", "L'Atlantide", "Bosch" | |
|
| art-music | "Hollywood Studio Symphony", "Atkinson , Danko and Ford ( with Brockie and Hilton )", "Champion Lover" | |
|
| art-other | "The Today Show", "Venus de Milo", "Aphrodite of Milos" | |
|
| art-painting | "Production/Reproduction", "Touit", "Cofiwch Dryweryn" | |
|
| art-writtenart | "The Seven Year Itch", "Imelda de ' Lambertazzi", "Time" | |
|
| building-airport | "Sheremetyevo International Airport", "Newark Liberty International Airport", "Luton Airport" | |
|
| building-hospital | "Yeungnam University Hospital", "Hokkaido University Hospital", "Memorial Sloan-Kettering Cancer Center" | |
|
| building-hotel | "The Standard Hotel", "Flamingo Hotel", "Radisson Blu Sea Plaza Hotel" | |
|
| building-library | "British Library", "Bayerische Staatsbibliothek", "Berlin State Library" | |
|
| building-other | "Henry Ford Museum", "Alpha Recording Studios", "Communiplex" | |
|
| building-restaurant | "Carnegie Deli", "Fatburger", "Trumbull" | |
|
| building-sportsfacility | "Boston Garden", "Sports Center", "Glenn Warner Soccer Facility" | |
|
| building-theater | "Sanders Theatre", "National Paris Opera", "Pittsburgh Civic Light Opera" | |
|
| event-attack/battle/war/militaryconflict | "Easter Offensive", "Jurist", "Vietnam War" | |
|
| event-disaster | "the 1912 North Mount Lyell Disaster", "1990s North Korean famine", "1693 Sicily earthquake" | |
|
| event-election | "Elections to the European Parliament", "March 1898 elections", "1982 Mitcham and Morden by-election" | |
|
| event-other | "Union for a Popular Movement", "Masaryk Democratic Movement", "Eastwood Scoring Stage" | |
|
| event-protest | "Iranian Constitutional Revolution", "French Revolution", "Russian Revolution" | |
|
| event-sportsevent | "World Cup", "National Champions", "Stanley Cup" | |
|
| location-GPE | "Croatian", "Mediterranean Basin", "the Republic of Croatia" | |
|
| location-bodiesofwater | "Arthur Kill", "Atatürk Dam Lake", "Norfolk coast" | |
|
| location-island | "new Samsat district", "Laccadives", "Staten Island" | |
|
| location-mountain | "Salamander Glacier", "Miteirya Ridge", "Ruweisat Ridge" | |
|
| location-other | "Victoria line", "Northern City Line", "Cartuther" | |
|
| location-park | "Painted Desert Community Complex Historic District", "Gramercy Park", "Shenandoah National Park" | |
|
| location-road/railway/highway/transit | "NJT", "Newark-Elizabeth Rail Link", "Friern Barnet Road" | |
|
| organization-company | "Texas Chicken", "Dixy Chicken", "Church 's Chicken" | |
|
| organization-education | "MIT", "Belfast Royal Academy and the Ulster College of Physical Education", "Barnard College" | |
|
| organization-government/governmentagency | "Congregazione dei Nobili", "Diet", "Supreme Court" | |
|
| organization-media/newspaper | "Clash", "Al Jazeera", "TimeOut Melbourne" | |
|
| organization-other | "Defence Sector C", "IAEA", "4th Army" | |
|
| organization-politicalparty | "Al Wafa ' Islamic", "Shimpotō", "Kenseitō" | |
|
| organization-religion | "UPCUSA", "Christian", "Jewish" | |
|
| organization-showorganization | "Lizzy", "Bochumer Symphoniker", "Mr. Mister" | |
|
| organization-sportsleague | "China League One", "NHL", "First Division" | |
|
| organization-sportsteam | "Arsenal", "Luc Alphand Aventures", "Tottenham" | |
|
| other-astronomything | "Algol", "`` Caput Larvae ''", "Zodiac" | |
|
| other-award | "Order of the Republic of Guinea and Nigeria", "Grand Commander of the Order of the Niger", "GCON" | |
|
| other-biologything | "N-terminal lipid", "Amphiphysin", "BAR" | |
|
| other-chemicalthing | "uranium", "carbon dioxide", "sulfur" | |
|
| other-currency | "$", "lac crore", "Travancore Rupee" | |
|
| other-disease | "bladder cancer", "French Dysentery Epidemic of 1779", "hypothyroidism" | |
|
| other-educationaldegree | "BSc ( Hons ) in physics", "Bachelor", "Master" | |
|
| other-god | "Raijin", "Fujin", "El" | |
|
| other-language | "Breton-speaking", "Latin", "English" | |
|
| other-law | "Leahy–Smith America Invents Act ( AIA", "United States Freedom Support Act", "Thirty Years ' Peace" | |
|
| other-livingthing | "monkeys", "patchouli", "insects" | |
|
| other-medical | "amitriptyline", "Pediatrics", "pediatrician" | |
|
| person-actor | "Tchéky Karyo", "Edmund Payne", "Ellaline Terriss" | |
|
| person-artist/author | "Hicks", "Gaetano Donizett", "George Axelrod" | |
|
| person-athlete | "Tozawa", "Neville", "Jaguar" | |
|
| person-director | "Richard Quine", "Bob Swaim", "Frank Darabont" | |
|
| person-other | "Campbell", "Holden", "Richard Benson" | |
|
| person-politician | "William", "Rivière", "Emeric" | |
|
| person-scholar | "Wurdack", "Stalmine", "Stedman" | |
|
| person-soldier | "Joachim Ziegler", "Helmuth Weidling", "Krukenberg" | |
|
| product-airplane | "Spey-equipped FGR.2s", "EC135T2 CPDS", "Luton" | |
|
| product-car | "Phantom", "100EX", "Corvettes - GT1 C6R" | |
|
| product-food | "red grape", "yakiniku", "V. labrusca" | |
|
| product-game | "Hardcore RPG", "Splinter Cell", "Airforce Delta" | |
|
| product-other | "X11", "PDP-1", "Fairbottom Bobs" | |
|
| product-ship | "Essex", "Congress", "HMS `` Chinkara ''" | |
|
| product-software | "AmiPDF", "Wikipedia", "Apdf" | |
|
| product-train | "55022", "Royal Scots Grey", "High Speed Trains" | |
|
| product-weapon | "AR-15 's", "ZU-23-2MR Wróbel II", "ZU-23-2M Wróbel" | |
|
|
|
## Uses |
|
|
|
### Direct Use for Inference |
|
|
|
```python |
|
from span_marker import SpanMarkerModel |
|
|
|
# Download from the 🤗 Hub |
|
model = SpanMarkerModel.from_pretrained("guishe/span-marker-generic-entity_recognition-v1-fewnerd-fine-super") |
|
# Run inference |
|
entities = model.predict("Most of the Steven Seagal movie \"Under Siege \"(co-starring Tommy Lee Jones) was filmed on the, which is docked on Mobile Bay at Battleship Memorial Park and open to the public.") |
|
``` |
|
|
|
### Downstream Use |
|
You can finetune this model on your own dataset. |
|
|
|
<details><summary>Click to expand</summary> |
|
|
|
```python |
|
from span_marker import SpanMarkerModel, Trainer |
|
|
|
# Download from the 🤗 Hub |
|
model = SpanMarkerModel.from_pretrained("guishe/span-marker-generic-entity_recognition-v1-fewnerd-fine-super") |
|
|
|
# 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("guishe/span-marker-generic-entity_recognition-v1-fewnerd-fine-super-finetuned") |
|
``` |
|
</details> |
|
|
|
|
|
## Training Details |
|
|
|
### Training Set Metrics |
|
| Training set | Min | Median | Max | |
|
|:----------------------|:----|:--------|:----| |
|
| Sentence length | 1 | 24.4945 | 267 | |
|
| Entities per sentence | 0 | 2.5832 | 88 | |
|
|
|
### Training Hyperparameters |
|
- learning_rate: 1e-05 |
|
- train_batch_size: 16 |
|
- eval_batch_size: 16 |
|
- seed: 42 |
|
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 |
|
- lr_scheduler_type: linear |
|
- lr_scheduler_warmup_ratio: 0.1 |
|
- num_epochs: 3 |
|
|
|
### Training Results |
|
| Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy | |
|
|:------:|:-----:|:---------------:|:--------------------:|:-----------------:|:-------------:|:-------------------:| |
|
| 0.2980 | 3000 | 0.0290 | 0.6503 | 0.6402 | 0.6452 | 0.9109 | |
|
| 0.5961 | 6000 | 0.0250 | 0.6749 | 0.6794 | 0.6772 | 0.9202 | |
|
| 0.8941 | 9000 | 0.0236 | 0.6908 | 0.6871 | 0.6889 | 0.9229 | |
|
| 1.1921 | 12000 | 0.0234 | 0.6853 | 0.7007 | 0.6929 | 0.9239 | |
|
| 1.4902 | 15000 | 0.0227 | 0.6966 | 0.6929 | 0.6948 | 0.9241 | |
|
| 1.7882 | 18000 | 0.0221 | 0.7073 | 0.6922 | 0.6997 | 0.9250 | |
|
| 2.0862 | 21000 | 0.0223 | 0.7003 | 0.6993 | 0.6998 | 0.9252 | |
|
| 2.3843 | 24000 | 0.0222 | 0.6971 | 0.7027 | 0.6999 | 0.9254 | |
|
| 2.6823 | 27000 | 0.0219 | 0.7044 | 0.7004 | 0.7024 | 0.9259 | |
|
| 2.9803 | 30000 | 0.0219 | 0.7047 | 0.7032 | 0.7040 | 0.9261 | |
|
|
|
### Framework Versions |
|
- Python: 3.10.8 |
|
- SpanMarker: 1.5.0 |
|
- Transformers: 4.28.0 |
|
- PyTorch: 1.13.1+cu117 |
|
- Datasets: 2.14.4 |
|
- Tokenizers: 0.13.3 |
|
|
|
## Citation |
|
|
|
### BibTeX |
|
``` |
|
@software{Aarsen_SpanMarker, |
|
author = {Aarsen, Tom}, |
|
license = {Apache-2.0}, |
|
title = {{SpanMarker for Named Entity Recognition}}, |
|
url = {https://github.com/tomaarsen/SpanMarkerNER} |
|
} |
|
``` |
|
|