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

test-bert-finetuned-ner

This model is a fine-tuned version of bert-base-cased on the conll2003 dataset. It achieves the following results on the evaluation set:

  • Loss: 0.0600
  • Precision: 0.9355
  • Recall: 0.9514
  • F1: 0.9433
  • Accuracy: 0.9868

Model description

More information needed

Use in Openmind

from openmind import pipeline, is_torch_npu_available
from openmind import AutoTokenizer, AutoModelForCausalLM
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
import argparse
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="jeffding/bert-finetuned-ner-openmind",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"
    
    start_time = time.time()
    classifier = pipeline(task="token-classification", model=model_path, framework="pt", device=device)

    output = classifier("Apple Inc. was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne in the garage of Steve Jobs childhood home in Los Altos, California. It was registered on January 3, 1977, initially named Apple Computer, but to commemorate its 30th anniversary and reflect the diversity of its products, the term computer was removed on January 9, 2015.")
    print(output)
    
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
    
if __name__ == "__main__":
    main()

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

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

Training results

Training LossEpochStepValidation LossPrecisionRecallF1Accuracy
0.08491.017560.07130.91440.93660.92530.9817
0.03592.035120.06580.93460.95000.94220.9860
0.02063.052680.06000.93550.95140.94330.9868

Framework versions

  • Transformers 4.11.0.dev0
  • Pytorch 1.8.1+cu111
  • Datasets 1.12.1.dev0
  • Tokenizers 0.10.3