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
# 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")Quick Links
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
{
"eval_loss": 0.04585767164826393,
"eval_precision": 0.9423943897144765,
"eval_recall": 0.9498485358465163,
"eval_f1": 0.9461067806554354,
"eval_accuracy": 0.99069350881975
}
Test results
{
"test_loss": 0.153057262301445,
"test_precision": 0.8865162734630618,
"test_recall": 0.9114730878186968,
"test_f1": 0.8988214753382803,
"test_accuracy": 0.9791105846882739
}
Usage
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.
- Downloads last month
- 10
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ullahhafeez321/roberta-conll2003-ner")