CoolFace
Modelpublic

sartajbhuvaji/bert-named-entity-recognition

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
4likes21downloads
Model Card

Model Card for Bert Named Entity Recognition

Model Description

This is a chat fine-tuned version of google-bert/bert-base-uncased, designed to perform Named Entity Recognition on a text sentence imput.

  • Developed by: Sartaj
  • Finetuned from model: google-bert/bert-base-uncased
  • Language(s): English
  • License: apache-2.0
  • Framework: Hugging Face Transformers

Model Sources

Uses

Model can be used to recognize Named Entities in text.

Usage

python
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline

tokenizer = AutoTokenizer.from_pretrained("sartajbhuvaji/bert-named-entity-recognition")
model = AutoModelForTokenClassification.from_pretrained("sartajbhuvaji/bert-named-entity-recognition")

nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Wolfgang and I live in Berlin"

ner_results = nlp(example)
print(ner_results)
json
[
  {
    "end": 19,
    "entity": "B-PER",
    "index": 4,
    "score": 0.99633455,
    "start": 11,
    "word": "wolfgang"
  },
  {
    "end": 40,
    "entity": "B-LOC",
    "index": 9,
    "score": 0.9987465,
    "start": 34,
    "word": "berlin"
  }
]

Training Details

AbbreviationDescription
OOutside of a named entity
B-MISCBeginning of a miscellaneous entity right after another miscellaneous entity
I-MISCMiscellaneous entity
B-PERBeginning of a person's name right after another person's name
I-PERPerson's name
B-ORGBeginning of an organization right after another organization
I-ORGOrganization
B-LOCBeginning of a location right after another location
I-LOCLocation

Training Procedure

  • Full Model Finetune
  • Epochs : 5
Training Loss Curves

image/png

Trainer

  • global_step: 4390
  • training_loss: 0.040937909830132485
  • train_runtime: 206.3611
  • trainsamplesper_second: 340.205
  • trainstepsper_second: 21.273
  • total_flos: 1702317283240608.0
  • train_loss: 0.040937909830132485
  • epoch: 5.0

Evaluation

  • Precision: 0.8992
  • Recall: 0.9115
  • F1 Score: 0.9053

Classification Report

ClassPrecisionRecallF1-ScoreSupport
LOC0.910.930.921668
MISC0.760.810.78702
ORG0.870.880.881661
PER0.980.970.971617
Micro Avg0.900.910.915648
Macro Avg0.880.900.895648
Weighted Avg0.900.910.915648
  • Evaluation Dataset : eriktks/conll2003