Instructions to use RGarrido03/modernbert-conll2003-ner-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RGarrido03/modernbert-conll2003-ner-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="RGarrido03/modernbert-conll2003-ner-large")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("RGarrido03/modernbert-conll2003-ner-large") model = AutoModelForTokenClassification.from_pretrained("RGarrido03/modernbert-conll2003-ner-large") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,133 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- token-classification
|
| 7 |
+
- ner
|
| 8 |
+
- modernbert
|
| 9 |
+
datasets:
|
| 10 |
+
- eriktks/conll2003
|
| 11 |
+
metrics:
|
| 12 |
+
- precision
|
| 13 |
+
- recall
|
| 14 |
+
- f1
|
| 15 |
+
- accuracy
|
| 16 |
+
model-index:
|
| 17 |
+
- name: ModernBERT-large-conll2003-ner
|
| 18 |
+
results:
|
| 19 |
+
- task:
|
| 20 |
+
type: token-classification
|
| 21 |
+
name: Named Entity Recognition
|
| 22 |
+
dataset:
|
| 23 |
+
name: CoNLL-2003
|
| 24 |
+
type: eriktks/conll2003
|
| 25 |
+
split: test
|
| 26 |
+
metrics:
|
| 27 |
+
- name: Precision
|
| 28 |
+
type: precision
|
| 29 |
+
value: 0.8721
|
| 30 |
+
- name: Recall
|
| 31 |
+
type: recall
|
| 32 |
+
value: 0.8985
|
| 33 |
+
- name: F1
|
| 34 |
+
type: f1
|
| 35 |
+
value: 0.8851
|
| 36 |
+
- name: Accuracy
|
| 37 |
+
type: accuracy
|
| 38 |
+
value: 0.9711
|
| 39 |
+
base_model:
|
| 40 |
+
- answerdotai/ModernBERT-base
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
# ModernBERT-large Fine-tuned on CoNLL-2003 for NER
|
| 44 |
+
|
| 45 |
+
This model is a fine-tuned version of [answerdotai/ModernBERT-large](https://huggingface.co/answerdotai/ModernBERT-large) on the [CoNLL-2003](https://huggingface.co/datasets/eriktks/conll2003) dataset for Named Entity Recognition (NER).
|
| 46 |
+
|
| 47 |
+
ModernBERT's architecture allows for efficient processing of long sequences and features optimized attention mechanisms, making it an excellent backbone for dense token-classification tasks like NER.
|
| 48 |
+
|
| 49 |
+
## Model Description
|
| 50 |
+
|
| 51 |
+
- **Developed by:** Rúben Garrido
|
| 52 |
+
- **Model type:** ModernBERT (Encoder-only Transformer)
|
| 53 |
+
- **Task:** Named Entity Recognition (NER)
|
| 54 |
+
- **Labels:** O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISC
|
| 55 |
+
|
| 56 |
+
## Intended Uses & Limitations
|
| 57 |
+
|
| 58 |
+
This model is intended for identifying entities (Persons, Organizations, Locations, and Miscellaneous) in English text.
|
| 59 |
+
|
| 60 |
+
### How to use
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from transformers import pipeline
|
| 64 |
+
|
| 65 |
+
ner_pipeline = pipeline("ner", model="RGarrido03/modernbert-conll2003-ner", aggregation_strategy="simple")
|
| 66 |
+
text = "The CERN headquarters are located in Geneva, Switzerland."
|
| 67 |
+
results = ner_pipeline(text)
|
| 68 |
+
|
| 69 |
+
for entity in results:
|
| 70 |
+
print(f"Entity: {entity['word']}, Label: {entity['entity_group']}, Score: {entity['score']:.4f}")
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
## Training Data
|
| 74 |
+
|
| 75 |
+
The model was trained on the **CoNLL-2003** dataset, which consists of Reuters news stories from 1996 and 1997.
|
| 76 |
+
|
| 77 |
+
- **Train samples:** 14,041
|
| 78 |
+
- **Validation samples:** 3,250
|
| 79 |
+
- **Test samples:** 3,453
|
| 80 |
+
|
| 81 |
+
## Training Procedure
|
| 82 |
+
|
| 83 |
+
### Training Hyperparameters
|
| 84 |
+
|
| 85 |
+
The following hyperparameters were used during training:
|
| 86 |
+
|
| 87 |
+
- **Learning rate:** 5e-5 (with AdamW optimizer)
|
| 88 |
+
- **Batch size:** 8
|
| 89 |
+
- **Epochs:** 3.0
|
| 90 |
+
- **Weight decay:** 0.01
|
| 91 |
+
- **Warmup ratio:** 0.1
|
| 92 |
+
- **Max sequence length:** 256
|
| 93 |
+
- **Label all tokens:** True (subword pieces inherit parent labels)
|
| 94 |
+
|
| 95 |
+
### Training Results (Evaluation on Test Split)
|
| 96 |
+
|
| 97 |
+
| Metric | Value |
|
| 98 |
+
| :------------ | :----- |
|
| 99 |
+
| **Accuracy** | 0.9711 |
|
| 100 |
+
| **F1 Score** | 0.8851 |
|
| 101 |
+
| **Precision** | 0.8721 |
|
| 102 |
+
| **Recall** | 0.8985 |
|
| 103 |
+
| **Loss** | 0.1873 |
|
| 104 |
+
|
| 105 |
+
## Evaluation on Validation Split
|
| 106 |
+
|
| 107 |
+
| Metric | Value |
|
| 108 |
+
| :------------ | :----- |
|
| 109 |
+
| **Accuracy** | 0.9871 |
|
| 110 |
+
| **F1 Score** | 0.9416 |
|
| 111 |
+
| **Precision** | 0.9357 |
|
| 112 |
+
| **Recall** | 0.9475 |
|
| 113 |
+
| **Loss** | 0.0625 |
|
| 114 |
+
|
| 115 |
+
## Environmental Impact
|
| 116 |
+
|
| 117 |
+
- **Runtime:** ~11.5 minutes (694 seconds)
|
| 118 |
+
- **Hardware:** MacBook Pro, M5 Pro 24GB (Training speed: ~62 samples/sec)
|
| 119 |
+
|
| 120 |
+
## Citation
|
| 121 |
+
|
| 122 |
+
If you use this model, please cite the original CoNLL-2003 paper and the ModernBERT work.
|
| 123 |
+
|
| 124 |
+
```bibtex
|
| 125 |
+
@inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
|
| 126 |
+
title = "Introduction to the {CoNLL}-2003 Shared Task: Language-Independent Named Entity Recognition",
|
| 127 |
+
author = "Tjong Kim Sang, Erik F. and De Meulder, Fien",
|
| 128 |
+
booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at {HLT}-{NAACL} 2003",
|
| 129 |
+
year = "2003",
|
| 130 |
+
url = "https://aclanthology.org/W03-0419",
|
| 131 |
+
pages = "142--147",
|
| 132 |
+
}
|
| 133 |
+
```
|