vinapatri commited on
Commit
6b84115
·
verified ·
1 Parent(s): ab0f392

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -2
README.md CHANGED
@@ -1,6 +1,63 @@
1
  ---
2
  license: apache-2.0
3
  base_model:
4
- - indobenchmark/indobert-base-p1
5
  pipeline_tag: text-classification
6
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  base_model:
4
+ - indobenchmark/indobert-base-p1
5
  pipeline_tag: text-classification
6
+ tags:
7
+ - indobert
8
+ - intent-classification
9
+ - jkn-kis
10
+ - bpjs
11
+ - bahasa-indonesia
12
+ - healthcare
13
+ - nlp
14
+ language:
15
+ - id
16
+ library_name: transformers
17
+ model_type: bert
18
+ ---
19
+
20
+ # 🩺 IndoBERT for Intent Classification on JKN-KIS Data
21
+
22
+ 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.
23
+
24
+ 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.
25
+
26
+ ---
27
+
28
+ ## 🚀 How to Use
29
+
30
+ Make sure to load your model and tokenizer, and also the label encoder (`le`) if you're using `LabelEncoder` from `sklearn`.
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
34
+ import torch
35
+ import joblib # only needed if you use sklearn LabelEncoder
36
+
37
+ # Load model and tokenizer
38
+ model_name = "vinapatri/intent-classification-jkn-kis"
39
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
40
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
41
+
42
+ # Load the label encoder used during training
43
+ le = joblib.load("label_encoder.pkl")
44
+
45
+ def predict_intent(text):
46
+ inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
47
+
48
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
49
+ model.to(device)
50
+ inputs = {k: v.to(device) for k, v in inputs.items()}
51
+
52
+ with torch.no_grad():
53
+ outputs = model(**inputs)
54
+
55
+ logits = outputs.logits
56
+ predicted_class_id = logits.argmax().item()
57
+ tag = le.inverse_transform([predicted_class_id])[0]
58
+ return tag
59
+
60
+ # Example
61
+ text = "Apa tata cara memperoleh surat keterangan tidak mampu untuk BPJS?"
62
+ predicted_intent = predict_intent(text)
63
+ print(f"Intent: {predicted_intent}")