eriktks/conll2003
Updated โข 42.3k โข 184
How to use Samira-Hassan/bert-ner-production-model with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="Samira-Hassan/bert-ner-production-model") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Samira-Hassan/bert-ner-production-model")
model = AutoModelForTokenClassification.from_pretrained("Samira-Hassan/bert-ner-production-model", device_map="auto")This model is a fine-tuned version of bert-base-cased on the CoNLL-2003 dataset for English Named Entity Recognition (NER). It identifies four standard entity types: Persons (PER), Organizations (ORG), Locations (LOC), and Miscellaneous entities (MISC).
BertForTokenClassification)bert-base-caseden)Evaluated on the CoNLL-2003 test split:
| Metric | Score |
|---|---|
| Entity F1-Score | 0.9016 |
You can load and run inference with this model directly using the Hugging Face transformers pipeline:
from transformers import pipeline
ner_pipeline = pipeline(
"ner",
model="Samira-Hassan/bert-ner-production-model",
aggregation_strategy="simple"
)
text = "Samira Hassan works as a Machine Learning Engineer in Cairo and collaborates with Hugging Face."
entities = ner_pipeline(text)
for entity in entities:
print(f"{entity['word']} -> {entity['entity_group']} (Score: {entity['score']:.4f})")