vinapatri's picture
Update README.md
6b84115 verified
---
license: apache-2.0
base_model:
- indobenchmark/indobert-base-p1
pipeline_tag: text-classification
tags:
- indobert
- intent-classification
- jkn-kis
- bpjs
- bahasa-indonesia
- healthcare
- nlp
language:
- id
library_name: transformers
model_type: bert
---
# 🩺 IndoBERT for Intent Classification on JKN-KIS Data
This model is a fine-tuned version of [`indobenchmark/indobert-base-p1`](https://huggingface.co/indobenchmark/indobert-base-p1), adapted for **intent classification** on question data related to the **Jaminan Kesehatan Nasional – Kartu Indonesia Sehat (JKN-KIS)** program.
The model is trained to recognize user intent from common questions asked in the context of **BPJS Kesehatan** services, such as registration, benefits, payment, eligibility, and more.
---
## 🚀 How to Use
Make sure to load your model and tokenizer, and also the label encoder (`le`) if you're using `LabelEncoder` from `sklearn`.
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import joblib # only needed if you use sklearn LabelEncoder
# Load model and tokenizer
model_name = "vinapatri/intent-classification-jkn-kis"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Load the label encoder used during training
le = joblib.load("label_encoder.pkl")
def predict_intent(text):
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
inputs = {k: v.to(device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class_id = logits.argmax().item()
tag = le.inverse_transform([predicted_class_id])[0]
return tag
# Example
text = "Apa tata cara memperoleh surat keterangan tidak mampu untuk BPJS?"
predicted_intent = predict_intent(text)
print(f"Intent: {predicted_intent}")