nahiar commited on
Commit
3d82495
ยท
verified ยท
1 Parent(s): aed3fae

Initial upload (auto-create if missing)

Browse files
Files changed (1) hide show
  1. README.md +184 -0
README.md ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - id
4
+ - ace
5
+ - ban
6
+ - bjn
7
+ - bug
8
+ - jav
9
+ - mad
10
+ - min
11
+ - sun
12
+ - bbc
13
+ - eng
14
+ library_name: transformers
15
+ pipeline_tag: text-classification
16
+ tags:
17
+ - text-classification
18
+ - hate-speech-detection
19
+ - indonesian
20
+ - multilingual
21
+ - social-media
22
+ - natural-language-processing
23
+ - xlm-roberta
24
+ license: apache-2.0
25
+ metrics:
26
+ - accuracy
27
+ - f1
28
+ base_model:
29
+ - FacebookAI/xlm-roberta-base
30
+ ---
31
+
32
+ # Hate Speech Detection for Social Media Text
33
+ **Multilingual Indonesian & English โ€” XLM-RoBERTa**
34
+
35
+ This repository provides a fine-tuned **XLM-RoBERTa** model for **Hate Speech detection** in social media text.
36
+ The model is designed to identify **hate speech vs non-hate speech** across **Indonesian**, **regional Indonesian languages**, and **English**, particularly in noisy and informal online conversations.
37
+
38
+ ---
39
+
40
+ ## ๐Ÿš€ Highlights
41
+
42
+ - Binary classification: **Hate Speech / Non-Hate**
43
+ - Multilingual support (Indonesia + English)
44
+ - Robust on informal and user-generated content
45
+ - Ready-to-use with Hugging Face `pipeline`
46
+ - Suitable for content moderation and safety systems
47
+
48
+ ---
49
+
50
+ ## ๐ŸŒ Supported Languages
51
+
52
+ - ๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia
53
+ - Bahasa Melayu
54
+ - Indonesian regional languages (Aceh, Banjar, Bugis, Jawa, Madura, Minang, Sunda, dll.)
55
+ - ๐Ÿ‡ฌ๐Ÿ‡ง English
56
+
57
+ ---
58
+
59
+ ## ๐Ÿ“Š Model Performance
60
+
61
+ > Performance metrics are reported on a held-out validation set.
62
+
63
+ | Metric | Score |
64
+ |-----------------|--------|
65
+ | Accuracy | 0.9180 |
66
+ | F1 (Macro) | 0.9179 |
67
+ | F1 (Weighted) | 0.9200 |
68
+ | Training Loss | 0.9200 |
69
+ | Validation Loss | 0.9200 |
70
+
71
+
72
+ *(Exact scores may vary depending on evaluation split and threshold.)*
73
+
74
+ ---
75
+
76
+ ## โš™๏ธ Usage
77
+
78
+ ### Installation
79
+ ```bash
80
+ pip install transformers torch
81
+ ````
82
+
83
+ ### Single Prediction
84
+
85
+ ```python
86
+ from transformers import pipeline
87
+
88
+ classifier = pipeline(
89
+ "text-classification",
90
+ model="nahiar/hatespeech-xlmr-v4"
91
+ )
92
+
93
+ result = classifier("Dasar bodoh, otak udang!")
94
+ print(result)
95
+ ```
96
+
97
+ **Output**
98
+
99
+ ```text
100
+ [{'label': 'LABEL_1', 'score': 0.9821}]
101
+ ```
102
+
103
+ ### Label Mapping
104
+
105
+ ```text
106
+ LABEL_0 โ†’ NON_HATE
107
+ LABEL_1 โ†’ HATE_SPEECH
108
+ ```
109
+
110
+ ---
111
+
112
+ ## ๐Ÿ“ฆ Batch Inference
113
+
114
+ ```python
115
+ texts = [
116
+ "Kamu itu memang tidak berguna",
117
+ "Saya tidak setuju dengan pendapat kamu",
118
+ "Dasar kaum ini selalu bikin rusuh"
119
+ ]
120
+
121
+ results = classifier(texts)
122
+
123
+ for text, result in zip(texts, results):
124
+ print(f"{result['label']} ({result['score']:.4f}) โ†’ {text}")
125
+ ```
126
+
127
+ ---
128
+
129
+ ## ๐Ÿ—๏ธ Training Configuration
130
+
131
+ | Parameter | Value |
132
+ | ----------------- | ---------------- |
133
+ | Base Model | xlm-roberta-base |
134
+ | Training Strategy | Fine-tuning |
135
+ | Epochs | Multiple |
136
+ | Learning Rate | 2e-5 |
137
+ | Batch Size | 16 |
138
+ | Training Date | 2025-12-03 |
139
+
140
+ ---
141
+
142
+ ## ๐ŸŽฏ Intended Use
143
+
144
+ * Hate speech detection and moderation
145
+ * Content safety and compliance systems
146
+ * Pre-filtering for sentiment or topic analysis
147
+ * Social media monitoring dashboards
148
+
149
+ ---
150
+
151
+ ## โš ๏ธ Limitations
152
+
153
+ * Binary classification only (Hate / Non-Hate)
154
+ * Does not identify hate targets or categories
155
+ * Context-dependent sarcasm may be misclassified
156
+ * Not suitable for legal judgment without human review
157
+
158
+ ---
159
+
160
+ ## ๐Ÿ“œ License
161
+
162
+ This model is released under the **Apache License 2.0**
163
+ Free for research and commercial use.
164
+
165
+ ---
166
+
167
+ ## ๐Ÿ“š Citation
168
+
169
+ ```bibtex
170
+ @misc{djunaedi2025hatespeech,
171
+ author = {Raihan Hidayatulloh Djunaedi},
172
+ title = {Hate Speech Detection for Social Media Text},
173
+ year = {2025},
174
+ publisher = {Hugging Face},
175
+ url = {https://huggingface.co/nahiar/hatespeech-xlmr-v4}
176
+ }
177
+ ```
178
+
179
+ ---
180
+
181
+ ## ๐Ÿ™Œ Acknowledgements
182
+
183
+ * Hugging Face Transformers
184
+ * Facebook AI Research โ€” XLM-RoBERTa