Instructions to use cbc-528a/BamiBERT-ViMedNER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cbc-528a/BamiBERT-ViMedNER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="cbc-528a/BamiBERT-ViMedNER")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("cbc-528a/BamiBERT-ViMedNER") model = AutoModelForTokenClassification.from_pretrained("cbc-528a/BamiBERT-ViMedNER") - Notebooks
- Google Colab
- Kaggle
Base model
This model is fine-tuned from Qualcomm-AI-Research/BamiBERT for Vietnamese biomedical Named Entity Recognition (NER).
Dataset
This model was fine-tuned on the ViMedNER dataset.
Repository: https://github.com/tdtrinh11/ViMedNer
Training Hyperparameters
The model was fine-tuned from Qualcomm-AI-Research/BamiBERT for Vietnamese biomedical Named Entity Recognition (NER) using the following training configuration.
| Hyperparameter | Value |
|---|---|
| Max sequence length | 128 |
| Batch size | 32 |
| Learning rate | 5e-5 |
| Number of epochs | 30 |
| Warmup ratio | 0.1 |
| Weight decay | 0.01 |
| Gradient accumulation steps | 1 |
| Optimizer | AdamW |
| Learning rate scheduler | Linear with warmup |
| Task | Token Classification (NER) |
| Framework | Hugging Face Transformers |
Evaluation
The model was evaluated on the ViMedNER test set using the seqeval evaluation metrics for named entity recognition.
Overall Performance
| Metric | Score |
|---|---|
| Precision (Micro) | 0.6605 |
| Recall (Micro) | 0.7133 |
| F1 Score (Micro) | 0.6859 |
Per-Entity Performance
| Entity Type | Precision | Recall | F1 Score | Support |
|---|---|---|---|---|
ten_benh |
0.77 | 0.84 | 0.81 | 1805 |
trieu_chung_benh |
0.60 | 0.63 | 0.62 | 703 |
bien_phap_dieu_tri |
0.57 | 0.61 | 0.59 | 631 |
bien_phap_chan_doan |
0.64 | 0.67 | 0.66 | 303 |
nguyen_nhan_benh |
0.31 | 0.36 | 0.34 | 276 |
Aggregate Metrics
| Average | Precision | Recall | F1 Score |
|---|---|---|---|
| Micro | 0.66 | 0.71 | 0.69 |
| Macro | 0.58 | 0.62 | 0.60 |
| Weighted | 0.66 | 0.71 | 0.69 |
Note: Evaluation was performed using the
seqevallibrary on the official ViMedNER test split. The model achieves an overall micro F1-score of 68.6% on the ViMedNER test set. Performance is strongest on theten_benh(Disease) entity type with an F1-score of 0.81, whilenguyen_nhan_benh(Cause) remains the most challenging category due to its relatively small number of training examples and semantic diversity.
Quick Start
Install dependencies
pip install transformers torch
Load the Model
from transformers import AutoTokenizer
from transformers import AutoModelForTokenClassification
MODEL_NAME = "cbc-528a/BamiBERT-ViMedNER"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForTokenClassification.from_pretrained(MODEL_NAME)
Example Inference
import torch
from transformers import AutoTokenizer
from transformers import AutoModelForTokenClassification
MODEL_NAME = "your-org/BamiBERT-ViMedNER"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForTokenClassification.from_pretrained(MODEL_NAME)
sentence = "Bệnh nhân bị ung thư gan và được điều trị bằng Sorafenib."
words = sentence.split()
inputs = tokenizer(
words,
is_split_into_words=True,
return_tensors="pt"
)
with torch.no_grad():
outputs = model(**inputs)
predictions = outputs.logits.argmax(dim=-1)[0]
word_ids = inputs.word_ids()
id2label = model.config.id2label
previous_word = None
for pred, word_idx in zip(predictions, word_ids):
if word_idx is None or word_idx == previous_word:
continue
previous_word = word_idx
print(
words[word_idx],
id2label[pred.item()]
)
Sample Output
Bệnh O
nhân O
bị O
ung B-ten_benh
thư I-ten_benh
gan I-ten_benh
và O
được O
điều O
trị O
bằng O
Sorafenib B-bien_phap_dieu_tri
. O
License
This model is a fine-tuned derivative of Qualcomm-AI-Research/BamiBERT.
Accordingly, use of this model is subject to:
- BSD 3-Clause Clear License
- Qualcomm Responsible AI License
Please refer to the original BamiBERT repository for the complete license terms.
Acknowledgements & Citation
This model is fine-tuned based on the BamiBERT architecture. I would like to express my gratitude to the original authors for their foundational work.
BibTeX:
@article{BamiBERT,
title = {{BamiBERT: A New BERT-based Language Model for Vietnamese}},
author = {Dat Quoc Nguyen and Thinh Pham and Chi Tran and Linh The Nguyen},
journal = {arXiv preprint},
volume = {arXiv:2607.02259},
year = {2026}
}
- Downloads last month
- -
Model tree for cbc-528a/BamiBERT-ViMedNER
Base model
Qualcomm-AI-Research/BamiBERT