Instructions to use 01pratyush/bert-finetuned-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 01pratyush/bert-finetuned-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="01pratyush/bert-finetuned-ner")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("01pratyush/bert-finetuned-ner") model = AutoModelForTokenClassification.from_pretrained("01pratyush/bert-finetuned-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
bert-finetuned-ner
This model is a fine-tuned version of bert-base-cased on tner/ontonotes5 dataset. It achieves the following results on the evaluation set:
- Loss: 0.1136
- Precision: 0.8655
- Recall: 0.8901
- F1: 0.8776
- Accuracy: 0.9798
Model Description
The model can be used for Token Classification, it has been fine-tuned for the purpose of Named Entity Recognition(NER).
Dataset Summary
Ontonotes5 NER dataset formatted in a part of TNER project.
Entity Types: CARDINAL, DATE, PERSON, NORP, GPE, LAW, PERCENT, ORDINAL, MONEY, WORK_OF_ART, FAC, TIME, QUANTITY, PRODUCT, LANGUAGE, ORG, LOC, EVENT
An example of train looks as follows.
{
'tags': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 11, 12, 12, 12, 12, 0, 0, 7, 0, 0, 0, 0, 0],
'tokens': ['``', 'It', "'s", 'very', 'costly', 'and', 'time', '-', 'consuming', ',', "''", 'says', 'Phil', 'Rosen', ',', 'a', 'partner', 'in', 'Fleet', '&', 'Leasing', 'Management', 'Inc.', ',', 'a', 'Boston', 'car', '-', 'leasing', 'company', '.']
}
Label ID
{
"O": 0,
"B-CARDINAL": 1,
"B-DATE": 2,
"I-DATE": 3,
"B-PERSON": 4,
"I-PERSON": 5,
"B-NORP": 6,
"B-GPE": 7,
"I-GPE": 8,
"B-LAW": 9,
"I-LAW": 10,
"B-ORG": 11,
"I-ORG": 12,
"B-PERCENT": 13,
"I-PERCENT": 14,
"B-ORDINAL": 15,
"B-MONEY": 16,
"I-MONEY": 17,
"B-WORK_OF_ART": 18,
"I-WORK_OF_ART": 19,
"B-FAC": 20,
"B-TIME": 21,
"I-CARDINAL": 22,
"B-LOC": 23,
"B-QUANTITY": 24,
"I-QUANTITY": 25,
"I-NORP": 26,
"I-LOC": 27,
"B-PRODUCT": 28,
"I-TIME": 29,
"B-EVENT": 30,
"I-EVENT": 31,
"I-FAC": 32,
"B-LANGUAGE": 33,
"I-PRODUCT": 34,
"I-ORDINAL": 35,
"I-LANGUAGE": 36
}
Data Splits
| Name | Train | Validation | Test |
|---|---|---|---|
| ontonotes5 | 59924 | 8528 | 8262 |
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 5
Training results
| Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|---|---|---|
| 0.0746 | 1.0 | 7491 | 0.0808 | 0.8399 | 0.8813 | 0.8601 | 0.9777 |
| 0.0527 | 2.0 | 14982 | 0.0801 | 0.8558 | 0.8884 | 0.8718 | 0.9795 |
| 0.0264 | 3.0 | 22473 | 0.0901 | 0.8624 | 0.8905 | 0.8762 | 0.9798 |
| 0.0147 | 4.0 | 29964 | 0.1057 | 0.8638 | 0.8880 | 0.8757 | 0.9796 |
| 0.0091 | 5.0 | 37455 | 0.1136 | 0.8655 | 0.8901 | 0.8776 | 0.9798 |
Framework versions
- Transformers 4.56.1
- Pytorch 2.8.0+cu126
- Datasets 4.0.0
- Tokenizers 0.22.0
- Downloads last month
- 10
Model tree for 01pratyush/bert-finetuned-ner
Base model
google-bert/bert-base-cased