| --- |
| language: |
| - id |
| base_model: |
| - Exqrch/IndoDiscourse-ToxicityClassifier |
| pipeline_tag: text-classification |
| --- |
| # mentilinSafe-BERT-Multiclass |
|
|
| Model ini adalah fine-tuned version dari `Exqrch/IndoDiscourse-ToxicityClassifier` (BERT) yang dikonfigurasi ulang untuk **Multi-class Classification** guna mendeteksi 19 jenis kategori bahaya (harm) dalam bahasa Indonesia berdasarkan dataset IndoSafety. |
|
|
| ## Detail Model |
| - **Base Model:** BERT (IndoDiscourse-ToxicityClassifier) |
| - **Tugas:** Multi-class Text Classification |
| - **Jumlah Kategori:** 19 Kategori |
| - **Akurasi Evaluasi:** 95.39% |
|
|
| ## Kategori yang Didukung |
| Model ini dapat mengklasifikasikan teks ke dalam kategori berikut: |
| - Adult Content |
| - Assisting illegal activities |
| - Causing material harm by disseminating misinformation e.g. in medicine or law |
| - Compromise privacy by leaking or inferring private information (person/individual) |
| - Disseminating false or misleading information |
| - Ethnicities and Cultural Practices |
| - Historical Controversies |
| - Indonesian Entities |
| - Mental Health or Overreliance Crisis |
| - Nudging or advising users to perform unethical or unsafe actions |
| - Pancasila Misinterpretation and Corruption |
| - Reducing the cost of disinformation campaigns |
| - Regional Separatism Advocacy |
| - Religions and Beliefs |
| - Risks from leaking or inferring sensitive information (organization/gov) |
| - Social stereotypes and unfair discrimination |
| - Supernatural |
| - Toxic language (hate speech) |
| - Treat Chatbot as a Human |
|
|
| ## Cara Penggunaan |
|
|
| ```python |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification |
| import torch |
| |
| model_name = "mSatashi/mentilinSafe-BERT-Multiclass" |
| tokenizer = AutoTokenizer.from_pretrained(model_name) |
| model = AutoModelForSequenceClassification.from_pretrained(model_name) |
| |
| def predict(text): |
| inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True) |
| with torch.no_grad(): |
| outputs = model(**inputs) |
| probs = torch.nn.functional.softmax(outputs.logits, dim=-1) |
| pred_id = torch.argmax(probs, dim=-1).item() |
| return model.config.id2label[pred_id], probs[0][pred_id].item() |
| |
| text = "Masukkan kalimat di sini" |
| label, score = predict(text) |
| print(f"Kategori: {label} ({score:.4f})") |
| ``` |
|
|
| ## Hasil Evaluasi |
| Berdasarkan pengujian pada dataset `IndoSafety-Eval-1`: |
| - **Accuracy:** 0.9539 |
| - **Loss:** 0.1924 |