bert finetuned ner

huggingface-course

Introduction

The BERT-Finetuned-NER model is a fine-tuned version of the bert-base-cased model, optimized for token classification tasks using the CoNLL-2003 dataset. The model achieves high performance on the evaluation set, with metrics including a precision of 0.9355, recall of 0.9514, an F1 score of 0.9433, and accuracy of 0.9868.

Architecture

The model is based on the BERT architecture, specifically the bert-base-cased variant. It is fine-tuned for Named Entity Recognition (NER) using the CoNLL-2003 dataset.

Training

Training Hyperparameters

  • Learning Rate: 2e-05
  • Train Batch Size: 8
  • Eval Batch Size: 8
  • Seed: 42
  • Optimizer: Adam (betas=(0.9, 0.999), epsilon=1e-08)
  • Learning Rate Scheduler Type: Linear
  • Number of Epochs: 3

Training Results

  • Epoch 1: Validation Loss: 0.0713, Precision: 0.9144, Recall: 0.9366, F1: 0.9253, Accuracy: 0.9817
  • Epoch 2: Validation Loss: 0.0658, Precision: 0.9346, Recall: 0.9500, F1: 0.9422, Accuracy: 0.9860
  • Epoch 3: Validation Loss: 0.0600, Precision: 0.9355, Recall: 0.9514, F1: 0.9433, Accuracy: 0.9868

Guide: Running Locally

  1. Clone the Repository:
    Clone the model repository from Hugging Face to your local machine.

  2. Install Dependencies:
    Ensure you have Python installed, along with the required libraries:

    • Transformers
    • PyTorch
    • Datasets
    • Tokenizers
  3. Load the Model:
    Use the Hugging Face transformers library to load the fine-tuned model and tokenizer.

  4. Run Inference:
    Prepare your input data and use the model to perform token classification.

Suggested Cloud GPUs

Consider using cloud services like AWS EC2 with GPU instances, Google Cloud Platform GPU instances, or NVIDIA's GPU Cloud for efficient training and inference.

License

This model is licensed under the Apache-2.0 License.

More Related APIs in Token Classification