Instructions to use AXKuhta/bert-finetuned-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AXKuhta/bert-finetuned-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="AXKuhta/bert-finetuned-ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("AXKuhta/bert-finetuned-ner") model = AutoModelForTokenClassification.from_pretrained("AXKuhta/bert-finetuned-ner") - Notebooks
- Google Colab
- Kaggle
| library_name: transformers | |
| license: apache-2.0 | |
| base_model: bert-base-uncased | |
| tags: | |
| - generated_from_trainer | |
| model-index: | |
| - name: bert-finetuned-ner | |
| results: [] | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # bert-finetuned-ner | |
| This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on the None dataset. | |
| It achieves the following results on the evaluation set: | |
| - Loss: 0.2481 | |
| - Model Preparation Time: 0.0021 | |
| ```ipython | |
| precision recall f1-score support | |
| B-COMMENT 0.88 0.90 0.89 767 | |
| B-NAME 0.91 0.91 0.91 1050 | |
| B-QTY 0.99 0.99 0.99 836 | |
| B-RANGE_END 0.93 1.00 0.96 13 | |
| B-UNIT 0.99 0.99 0.99 706 | |
| I-COMMENT 0.93 0.96 0.95 1499 | |
| I-NAME 0.92 0.84 0.88 572 | |
| OTHER 0.88 0.82 0.85 439 | |
| accuracy 0.93 5882 | |
| macro avg 0.93 0.93 0.93 5882 | |
| weighted avg 0.93 0.93 0.93 5882 | |
| ``` | |
| ## Usage | |
| ```ipython | |
| In [40]: from transformers import pipeline | |
| In [41]: | |
| In [41]: classifier = pipeline("token-classification", "AXKuhta/bert-finetuned-ner") | |
| Loading weights: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 199/199 [00:00<00:00, 9724.08it/s] | |
| In [42]: classifier.tokenizer.tokenize("mozzarella") | |
| Out[42]: ['mozzarella'] | |
| In [43]: classifier("1 pound broccoli", aggregation_strategy="simple") | |
| Out[43]: | |
| [{'entity_group': 'QTY', | |
| 'score': np.float32(0.9997178), | |
| 'word': '1', | |
| 'start': 0, | |
| 'end': 1}, | |
| {'entity_group': 'UNIT', | |
| 'score': np.float32(0.99991345), | |
| 'word': 'pound', | |
| 'start': 2, | |
| 'end': 7}, | |
| {'entity_group': 'NAME', | |
| 'score': np.float32(0.999385), | |
| 'word': 'broccoli', | |
| 'start': 8, | |
| 'end': 16}] | |
| ``` | |
| ## Training procedure | |
| See bert_finetune_fin.ipynb | |
| ### Training hyperparameters | |
| The following hyperparameters were used during training: | |
| - learning_rate: 4e-05 | |
| - train_batch_size: 16 | |
| - eval_batch_size: 16 | |
| - 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: 6 | |
| ### Framework versions | |
| - Transformers 5.6.2 | |
| - Pytorch 2.11.0+cu126 | |
| - Datasets 3.6.0 | |
| - Tokenizers 0.22.2 | |