Token Classification
Transformers
Safetensors
English
roberta
named-entity-recognition
ner
conll2003
Instructions to use ullahhafeez321/roberta-conll2003-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ullahhafeez321/roberta-conll2003-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ullahhafeez321/roberta-conll2003-ner")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ullahhafeez321/roberta-conll2003-ner") model = AutoModelForTokenClassification.from_pretrained("ullahhafeez321/roberta-conll2003-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from ullahhafeez321/roberta-conll2003-ner: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/ullahhafeez321/roberta-conll2003-ner/resolve/main/README.md
- Command line
-
hf download hf://ullahhafeez321/roberta-conll2003-ner/README.md
-
curl -L -o README.md https://huggingface.co/ullahhafeez321/roberta-conll2003-ner/resolve/main/README.md
1.6 kB
| language: | |
| - en | |
| license: mit | |
| library_name: transformers | |
| pipeline_tag: token-classification | |
| tags: | |
| - named-entity-recognition | |
| - ner | |
| - token-classification | |
| - roberta | |
| - conll2003 | |
| # RoBERTa CoNLL-2003 NER | |
| An encoder-only RoBERTa model fine-tuned for English Named Entity Recognition. | |
| ## Model details | |
| - Base model: `FacebookAI/roberta-base` | |
| - Dataset: `lhoestq/conll2003` | |
| - Task: Token classification / Named Entity Recognition | |
| - Labels: O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISC | |
| - Maximum sequence length: 256 | |
| ## Training | |
| Fine-tuned using Hugging Face Transformers Trainer. | |
| Word-level labels are aligned to the first subword token. | |
| Special tokens and continuation subwords are ignored using label ID `-100`. | |
| ## Validation results | |
| ```json | |
| { | |
| "eval_loss": 0.04585767164826393, | |
| "eval_precision": 0.9423943897144765, | |
| "eval_recall": 0.9498485358465163, | |
| "eval_f1": 0.9461067806554354, | |
| "eval_accuracy": 0.99069350881975 | |
| } | |
| ``` | |
| ## Test results | |
| ```json | |
| { | |
| "test_loss": 0.153057262301445, | |
| "test_precision": 0.8865162734630618, | |
| "test_recall": 0.9114730878186968, | |
| "test_f1": 0.8988214753382803, | |
| "test_accuracy": 0.9791105846882739 | |
| } | |
| ``` | |
| ## Usage | |
| ```python | |
| from transformers import pipeline | |
| ner = pipeline( | |
| "token-classification", | |
| model="ullahhafeez321/roberta-conll2003-ner", | |
| aggregation_strategy="simple" | |
| ) | |
| print(ner("Hafeez works at Microsoft in Pakistan.")) | |
| ``` | |
| ## Repository contents | |
| This repository contains the fine-tuned model weights, | |
| model configuration with label mappings, tokenizer files, | |
| training information, and this model card. | |