Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- ontonotes/conll2012_ontonotesv5
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model:
|
| 8 |
+
- FacebookAI/roberta-large
|
| 9 |
+
pipeline_tag: token-classification
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# RoBERTa-large fine-tuned on OntoNotes 5.0
|
| 13 |
+
|
| 14 |
+
This model is a fine-tuned version of [FacebookAI/roberta-large](https://huggingface.co/FacebookAI/roberta-large) on the English subset of the **OntoNotes 5.0** (CoNLL-2012) dataset. RoBERTa-large features 24 layers and ~355M parameters, providing enhanced semantic understanding for complex Named Entity Recognition (NER) tasks compared to the base architecture.
|
| 15 |
+
|
| 16 |
+
## 📊 Performance
|
| 17 |
+
The following results were achieved on the OntoNotes 5.0 (v12) test set:
|
| 18 |
+
|
| 19 |
+
| **Entity** | **Precision** | **Recall** | **F1-Score** | **Support** |
|
| 20 |
+
| :--- | :---: | :---: | :---: | :---: |
|
| 21 |
+
| CARDINAL | 0.7769 | 0.7900 | 0.7834 | 1005 |
|
| 22 |
+
| DATE | 0.8211 | 0.8533 | 0.8369 | 1786 |
|
| 23 |
+
| EVENT | 0.5702 | 0.7647 | 0.6533 | 85 |
|
| 24 |
+
| FAC | 0.7123 | 0.6980 | 0.7051 | 149 |
|
| 25 |
+
| GPE | 0.9262 | 0.9470 | 0.9365 | 2546 |
|
| 26 |
+
| LANGUAGE | 0.7500 | 0.6818 | 0.7143 | 22 |
|
| 27 |
+
| LAW | 0.5000 | 0.6364 | 0.5600 | 44 |
|
| 28 |
+
| LOC | 0.6597 | 0.7302 | 0.6932 | 215 |
|
| 29 |
+
| MONEY | 0.8730 | 0.9099 | 0.8910 | 355 |
|
| 30 |
+
| NORP | 0.9029 | 0.9485 | 0.9251 | 990 |
|
| 31 |
+
| ORDINAL | 0.6936 | 0.7874 | 0.7376 | 207 |
|
| 32 |
+
| ORG | 0.8870 | 0.9101 | 0.8984 | 2002 |
|
| 33 |
+
| PERCENT | 0.8703 | 0.9066 | 0.8881 | 407 |
|
| 34 |
+
| PERSON | 0.9250 | 0.9246 | 0.9248 | 2134 |
|
| 35 |
+
| PRODUCT | 0.7356 | 0.7111 | 0.7232 | 90 |
|
| 36 |
+
| QUANTITY | 0.6933 | 0.6797 | 0.6865 | 153 |
|
| 37 |
+
| TIME | 0.6211 | 0.6267 | 0.6239 | 225 |
|
| 38 |
+
| WORK_OF_ART | 0.6686 | 0.6923 | 0.6802 | 169 |
|
| 39 |
+
| **micro avg** | **0.8581** | **0.8831** | **0.8704** | **12584** |
|
| 40 |
+
| **macro avg** | **0.7548** | **0.7888** | **0.7701** | **12584** |
|
| 41 |
+
| **weighted avg** | **0.8596** | **0.8831** | **0.8710** | **12584** |
|
| 42 |
+
|
| 43 |
+
## 🛠 Training Details
|
| 44 |
+
To optimize the 24-layer transformer on 2xNVIDIA V100 GPUs:
|
| 45 |
+
- **Architecture**: `RobertaForTokenClassification`
|
| 46 |
+
- **Tokenizer**: `RobertaTokenizerFast` (with `add_prefix_space=True`)
|
| 47 |
+
- **Learning Rate**: 1e-5
|
| 48 |
+
- **Effective Batch Size**: 32 (4 per device × 4 gradient accumulation steps)
|
| 49 |
+
- **Epochs**: 5
|
| 50 |
+
- **Warmup Ratio**: 0.1
|
| 51 |
+
- **Mixed Precision**: FP16 enabled
|
| 52 |
+
- **Optimizer**: AdamW with `weight_decay=0.01`
|
| 53 |
+
|
| 54 |
+
## 📂 Project Assets
|
| 55 |
+
- **GitHub Repository**: [Learnrr/ontonotes5_ner_evaluation](https://github.com/Learnrr/ontonotes5_ner_evaluation.git)
|
| 56 |
+
|
| 57 |
+
| **Asset** | **File** | **Description** |
|
| 58 |
+
| :--- | :--- | :--- |
|
| 59 |
+
| **Model Weights** | `model.safetensors` | Fine-tuned Large weights (~1.42 GB). |
|
| 60 |
+
| **Configuration** | `config.json` | 24-layer configuration and `id2label` map. |
|
| 61 |
+
| **Vocabulary** | `vocab.json` / `merges.txt` | BPE vocabulary and byte-level merge rules. |
|
| 62 |
+
| **Tokenizer** | `tokenizer.json` / `tokenizer_config.json` | Complete fast tokenizer setup. |
|
| 63 |
+
| **Special Tokens** | `special_tokens_map.json` | Definitions for BOS, EOS, and Padding tokens. |
|
| 64 |
+
| **Training Args** | `training_args.bin` | Hyperparameters used during the training run. |
|
| 65 |
+
|
| 66 |
+
## 🚀 Usage
|
| 67 |
+
```python
|
| 68 |
+
from transformers import pipeline
|
| 69 |
+
|
| 70 |
+
model_checkpoint = "learnrr/roberta-large-ontonotes5-ner"
|
| 71 |
+
token_classifier = pipeline(
|
| 72 |
+
"token-classification",
|
| 73 |
+
model=model_checkpoint,
|
| 74 |
+
aggregation_strategy="simple"
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
text = "The United Nations is headquartered in New York City."
|
| 78 |
+
results = token_classifier(text)
|
| 79 |
+
|
| 80 |
+
for entity in results:
|
| 81 |
+
print(f"Entity: {entity['word']} | Label: {entity['entity_group']} | Score: {entity['score']:.4f}")
|
| 82 |
+
```
|