Downloads · 30 days
8
3% of all-time downloads
heenamir/bert-finetuned-ner
bert-finetuned-ner is a token classification model from heenamir. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains a BERT model fine-tuned for Named Entity Recognition (NER) tasks. The model was fine-tuned using the Hugging Face transformers library and is capable of recognizing named entities like people,…
Downloads · 30 days
8
3% of all-time downloads
All-time downloads
312
Public
Repo size
1.7 GB
Likes
0
Public
Click a slice to open those files.
.bin431 MB · 100%
From the Hugging Face model README
This repository contains a BERT model fine-tuned for Named Entity Recognition (NER) tasks. The model was fine-tuned using the Hugging Face transformers library and is capable of recognizing named entities like people, locations, organizations, and more from text.
BERT-baseYou can use this model with the Hugging Face transformers library to quickly get started with NER tasks. Below is an example of how to load and use this model for inference.
First, make sure you have the required packages:
pip install transformers
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("heenamir/bert-finetuned-ner")
model = AutoModelForTokenClassification.from_pretrained("heenamir/bert-finetuned-ner")
# Initialize the NER pipeline
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
# Example text
text = "John Doe is a software engineer at OpenAI in San Francisco."
# Perform NER
entities = nlp(text)
print(entities)
The model will return a list of entities in the following format:
[
{"entity": "B-PER", "score": 0.99, "index": 1, "word": "John", "start": 0, "end": 4},
{"entity": "I-PER", "score": 0.98, "index": 2, "word": "Doe", "start": 5, "end": 8},
{"entity": "B-ORG", "score": 0.95, "index": 7, "word": "OpenAI", "start": 28, "end": 34},
{"entity": "B-LOC", "score": 0.97, "index": 10, "word": "San Francisco", "start": 38, "end": 51},
]
The model is fine-tuned to detect the following entity types:
The model outputs a score for each detected entity, representing its confidence level. You can use these scores to filter out low-confidence predictions if needed.
The model's performance can vary depending on the complexity and context of the input text. It performs well on structured text but may struggle with informal or highly technical language.
The model was evaluated on the CoNLL-2003 test set with the following metrics:
This model is available for use under the Apache License 2.0. See the LICENSE file for more details.
For more details on BERT and Named Entity Recognition, refer to the Hugging Face documentation.