Downloads · 30 days
597
1% of all-time downloads
yashpwr/resume-ner-bert-v2
resume-ner-bert-v2 is a token classification model from yashpwr. Use it when you need labels on individual words, such as names. The card lists the license as apache-2.0.
A state-of-the-art Named Entity Recognition (NER) model specifically designed for extracting structured information from resumes and CVs. This model achieves 90.87% F1 score and is trained on a comprehensive dataset o…
Downloads · 30 days
597
1% of all-time downloads
All-time downloads
46.7K
Public
Parameters
108M
862 MB on disk
Likes
17
Public
Click a slice to open those files.
.safetensors431 MB · 100%
From the Hugging Face model README
A state-of-the-art Named Entity Recognition (NER) model specifically designed for extracting structured information from resumes and CVs. This model achieves 90.87% F1 score and is trained on a comprehensive dataset of 22,542 resume samples from multiple sources.
This model has been extensively fine-tuned to extract key information from resumes including personal details, contact information, work experience, education, skills, and more. The model uses a BERT-based architecture with token classification capabilities, making it highly effective for resume parsing tasks.
| Metric | Score | Status |
|---|---|---|
| F1 Score | 90.87% | ✅ Excellent |
| Precision | 91.44% | ✅ High |
| Recall | 90.81% | ✅ High |
| Training Loss | 0.2604 | ✅ Low |
The model recognizes 25 entity types using BIO (Beginning-Inside-Outside) tagging:
B- (Beginning): Start of an entityI- (Inside): Continuation of an entityO (Outside): Non-entity tokensfrom transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
# Load model and tokenizer
model_name = "yashpwr/resume-ner-bert-v2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)
# Example resume text
text = "John Smith is a senior software engineer with 8 years of experience at Google. He has expertise in Python, JavaScript, and machine learning. Contact: [email protected]"
# Tokenize
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=128,
padding=True
)
# Predict
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=2)
# Extract entities
entities = []
current_entity = None
for i, pred in enumerate(predictions[0]):
label = model.config.id2label[pred.item()]
token = tokenizer.convert_ids_to_tokens(inputs['input_ids'][0][i])
if label.startswith('B-'):
if current_entity:
entities.append(current_entity)
current_entity = {
'text': token,
'label': label[2:], # Remove 'B-' prefix
'start': i
}
elif label.startswith('I-') and current_entity:
current_entity['text'] += ' ' + token
elif label == 'O':
if current_entity:
entities.append(current_entity)
current_entity = None
if current_entity:
entities.append(current_entity)
print("Extracted Entities:")
for entity in entities:
print(f"- {entity['label']}: {entity['text']}")
from transformers import pipeline
# Create NER pipeline
ner_pipeline = pipeline(
"token-classification",
model="yashpwr/resume-ner-bert-v2",
aggregation_strategy="simple"
)
# Extract entities
text = "Sarah Johnson holds a Master's degree in Computer Science from Stanford University. Skills: Python, TensorFlow, SQL."
results = ner_pipeline(text)
for entity in results:
print(f"{entity['entity_group']}: {entity['word']} (confidence: {entity['score']:.3f})")
from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
import numpy as np
# Load model
model_name = "yashpwr/resume-ner-bert-v2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)
def extract_entities_with_confidence(text, confidence_threshold=0.5):
"""Extract entities with confidence scores."""
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=128,
padding=True,
return_offsets_mapping=True
)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.argmax(outputs.logits, dim=2)
probabilities = torch.softmax(outputs.logits, dim=2)
entities = []
current_entity = None
offset_mapping = inputs.offset_mapping[0]
for i, (pred, offset) in enumerate(zip(predictions[0], offset_mapping)):
label = model.config.id2label[pred.item()]
confidence = probabilities[0][i][pred].item()
# Skip special tokens
if offset[0] == 0 and offset[1] == 0:
continue
if label.startswith('B-'):
if current_entity and current_entity['confidence'] >= confidence_threshold:
entities.append(current_entity)
entity_type = label[2:]
current_entity = {
'text': text[offset[0]:offset[1]],
'label': entity_type,
'start': offset[0],
'end': offset[1],
'confidence': confidence
}
elif label.startswith('I-') and current_entity:
entity_type = label[2:]
if entity_type == current_entity['label']:
current_entity['text'] += ' ' + text[offset[0]:offset[1]]
current_entity['end'] = offset[1]
current_entity['confidence'] = min(current_entity['confidence'], confidence)
elif label == 'O':
if current_entity and current_entity['confidence'] >= confidence_threshold:
entities.append(current_entity)
current_entity = None
if current_entity and current_entity['confidence'] >= confidence_threshold:
entities.append(current_entity)
return entities
# Example usage
text = "Michael Brown is a marketing manager with 10 years of experience at Coca-Cola. Contact: [email protected]"
entities = extract_entities_with_confidence(text, confidence_threshold=0.3)
for entity in entities:
print(f"{entity['label']}: '{entity['text']}' (confidence: {entity['confidence']:.3f})")
yashpwr/resume-ner-bertThe model was trained using a comprehensive pipeline that addressed several key challenges:
bert-base-cased throughout the pipeline to ensure consistent tokenization between training and inferencereturn_offsets_mapping=True for accurate text reconstructionpip install transformers torch datasets scikit-learn numpy
# Install required packages
pip install transformers[torch] datasets scikit-learn
# Or using conda
conda install pytorch transformers -c pytorch
This model is licensed under the Apache 2.0 License. This means you can:
See the LICENSE file for complete details.
We welcome contributions from the community! Here's how you can contribute:
For questions, issues, or support:
yashpwr/resume-ner-bert for the foundation architectureLast Updated: August 7, 2025
Version: v2
Status: Production Ready ✅
License: Apache 2.0
Repository: https://huggingface.co/yashpwr/resume-ner-bert-v2