DistilBERT Fine-Tuned for Named Entity Recognition (NER)
Hugging Face
DistilBERT
NER
This repository contains a DistilBERT model fine-tuned for Named Entity Recognition (NER). The model has been trained to identify and classify named entities such as names of people, places, organizations, and dates in text.
You can use this model with the Hugging Face transformers library to perform NER on your text data. Below are examples of how to use the model and tokenizer.
Installation
First, make sure you have the transformers library installed:
pip install transformers
Load the Model
python
1from transformers import pipeline
23# Load the model and tokenizer4token_classifier = pipeline(5"token-classification",6 model="cxx5208/NER_finetuned",7 tokenizer="cxx5208/NER_finetuned",8 aggregation_strategy="simple"9)1011# Example text12text ="My name is Yeshvanth Raju Kurapati. I study at San Jose State University"1314# Perform NER15entities = token_classifier(text)16print(entities)
Example Output
python
1[2{'entity_group':'PER',3'score':0.99808735,4'word':'Yeshvanth Raju Kurapati',5'start':11,6'end':34},7{'entity_group':'ORG',8'score':0.9923826,9'word':'San Jose State University',10'start':47,11'end':72}12]
Training Details
The model was fine-tuned using the following hyperparameters:
Batch Size: 16
Learning Rate: 5e-5
Epochs: 3
Optimizer: AdamW
The training process involved using a standard NER dataset (e.g., CoNLL-2003) and included steps for tokenization, data preprocessing, and evaluation.
Evaluation
The model was evaluated using precision, recall, F1-score, and accuracy metrics. The performance metrics are as follows:
Precision: 0.952
Recall: 0.948
F1-Score: 0.950
Accuracy: 0.975
About DistilBERT
DistilBERT is a smaller, faster, cheaper version of BERT developed by Hugging Face. It retains 97% of BERT’s language understanding capabilities while being 60% faster and 40% smaller.