eriktks/conll2003
Updated • 41.3k • 166
How to use Prikshit7766/bert-finetuned-ner with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="Prikshit7766/bert-finetuned-ner") # Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Prikshit7766/bert-finetuned-ner")
model = AutoModelForTokenClassification.from_pretrained("Prikshit7766/bert-finetuned-ner")This model was trained on the CoNLL 2003 dataset for Named Entity Recognition (NER) tasks.
The dataset includes the following labels:
O, B-PER, I-PER, B-ORG, I-ORG, B-LOC, I-LOC, B-MISC, I-MISCFor detailed descriptions of these labels, please refer to the dataset card.
bert-base-cased for token classification2e-5200.01epochepochAdditional default parameters from the Hugging Face Transformers library were used.
| Entity Type | Precision | Recall | F1 Score |
|---|---|---|---|
| LOC | 97.27% | 97.11% | 97.19% |
| MISC | 87.46% | 91.54% | 89.45% |
| ORG | 93.37% | 93.44% | 93.40% |
| PER | 96.02% | 98.15% | 97.07% |
| Entity Type | Precision | Recall | F1 Score |
|---|---|---|---|
| LOC | 92.87% | 92.87% | 92.87% |
| MISC | 75.55% | 82.76% | 78.99% |
| ORG | 88.32% | 90.61% | 89.45% |
| PER | 95.28% | 96.23% | 95.75% |
You can load the model directly from the Hugging Face Model Hub:
from transformers import pipeline
# Replace with your specific model checkpoint
model_checkpoint = "Prikshit7766/bert-finetuned-ner"
token_classifier = pipeline(
"token-classification",
model=model_checkpoint,
aggregation_strategy="simple"
)
# Example usage
result = token_classifier("My name is Sylvain and I work at Hugging Face in Brooklyn.")
print(result)
[
{
"entity_group":"PER",
"score":0.9999881,
"word":"Sylvain",
"start":11,
"end":18
},
{
"entity_group":"ORG",
"score":0.99961376,
"word":"Hugging Face",
"start":33,
"end":45
},
{
"entity_group":"LOC",
"score":0.99989843,
"word":"Brooklyn",
"start":49,
"end":57
}
]
Base model
google-bert/bert-base-cased