hf_mirrors/bert-large-uncased-finetuned-ner
Model Introduction
Files & versions
Analysis

bert-large-uncased-finetuned-ner

This model is a fine-tuned version of [bert-large-uncased] on the conll2003 dataset. It achieves the following results on the evaluation set:

  • Loss: 0.0778
  • Precision: 0.9505
  • Recall: 0.9575
  • F1: 0.9540
  • Accuracy: 0.9886

Model description

More information needed

Limitations and bias

This model is limited by its training dataset of entity-annotated news articles from a specific span of time. This may not generalize well for all use cases in different domains. Furthermore, the model occassionally tags subword tokens as entities and post-processing of results may be necessary to handle those cases.

How to use

You can use this model with openmind pipeline for NER.

from openmind import pipeline
from openmind  import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Changchun_Ascend/bert-large-uncased-finetuned-ner")
model = AutoModelForTokenClassification.from_pretrained("Changchun_Ascend/bert-large-uncased-finetuned-ner")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Scott and I live in Ohio"
ner_results = nlp(example)
print(ner_results)

{'entity': 'B-PER', 'score': 0.99951184, 'index': 4, 'word': 'scott', 'start': 11, 'end': 16}, {'entity': 'B-LOC', 'score': 0.9999815, 'index': 9, 'word': 'ohio', 'start': 31, 'end': 35}

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 2e-05
  • train_batch_size: 16
  • eval_batch_size: 64
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 10

Training results

Training LossEpochStepValidation LossPrecisionRecallF1Accuracy
0.19971.08780.05760.93160.92570.92860.9837
0.042.017560.04900.94000.95130.94560.9870
0.01993.026340.05570.94360.95400.94880.9879
0.01124.035120.06020.94430.95690.95060.9881
0.00685.043900.06310.94510.95890.95200.9882
0.00446.052680.06380.95100.95670.95380.9885
0.0037.061460.07220.94950.95600.95270.9885
0.00168.070240.07620.94910.95950.95430.9887
0.00189.079020.07690.94960.95420.95190.9883
0.000910.087800.07780.95050.95750.95400.9886