nahiar commited on
Commit
bc8bcd5
·
verified ·
1 Parent(s): d6b18c7

Upload model

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - id
4
+ - eng
5
+ library_name: transformers
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - text-classification
9
+ - spam-detection
10
+ - indonesian
11
+ - multilingual
12
+ - xlm-roberta
13
+ - social-media
14
+ license: apache-2.0
15
+ metrics:
16
+ - accuracy
17
+ - f1
18
+ base_model:
19
+ - FacebookAI/xlm-roberta-base
20
+ ---
21
+
22
+ # Spam Detection for Social Media Text
23
+ **Multilingual Indonesian & English | XLM-RoBERTa**
24
+
25
+ This model is a fine-tuned **XLM-RoBERTa** designed to detect **Spam vs Ham** content in social media text.
26
+ It supports **Indonesian** and **English Languages**, making it suitable for multi-platform moderation use cases such as Twitter/X, Instagram, TikTok, Facebook, and online forums.
27
+
28
+ ---
29
+
30
+ ## ✨ Key Features
31
+
32
+ - ✅ Spam vs Ham classification
33
+ - 🌏 Multilingual support (Indonesian & English)
34
+ - 🧠 Based on **XLM-RoBERTa (multilingual transformer)**
35
+ - ⚡ Ready-to-use with Hugging Face `pipeline`
36
+ - 📊 Strong performance on noisy social media text
37
+
38
+ ---
39
+
40
+ ## 🌍 Supported Languages
41
+
42
+ - 🇮🇩 Bahasa Indonesia
43
+ - 🇬🇧 English
44
+
45
+ ---
46
+
47
+ ## 🧪 Model Performance
48
+
49
+ | Metric | Score |
50
+ |---------------------|--------|
51
+ | Accuracy | 0.9645 |
52
+ | F1 (Macro) | 0.9639 |
53
+ | F1 (Weighted) | 0.9700 |
54
+ | Precision | 0.9700 |
55
+ | Recall | 0.9600 |
56
+ | Training Loss | 0.0637 |
57
+ | Validation Loss | 0.1242 |
58
+
59
+ > Evaluated on held-out validation data with balanced spam/ham distribution.
60
+
61
+ ---
62
+
63
+ ## 🚀 Quick Start
64
+
65
+ ### Installation
66
+ ```bash
67
+ pip install transformers torch
68
+ ````
69
+
70
+ ### Single Prediction
71
+
72
+ ```python
73
+ from transformers import pipeline
74
+
75
+ classifier = pipeline(
76
+ task="text-classification",
77
+ model="nahiar/spam-detection-xlm-roberta-v1"
78
+ )
79
+
80
+ result = classifier("PASTI DIJAMIN WDP 100%")
81
+ print(result)
82
+ ```
83
+
84
+ **Output**
85
+
86
+ ```python
87
+ [{'label': 'LABEL_1', 'score': 0.9876}]
88
+ ```
89
+
90
+ ### Label Mapping
91
+
92
+ ```text
93
+ LABEL_0 → SPAM
94
+ LABEL_1 → HAM
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 📦 Batch Inference Example
100
+
101
+ ```python
102
+ "texts": [
103
+ "साइबर हमले के बाद JLR का बड़ा बयान - जानें कंपनी ने क्या कहा | Tata Motors के शेयर पर दिखेगा असर?
104
+
105
+ #TataMotors #JLR #CyberAttack
106
+
107
+ https://t.co/6WlGS77UUp",
108
+ "Kita sudah Ready skrg ini bagi yang memerlukan jasa pemulihan akun & Hapus All akun
109
+
110
+ Lacak lokasi / sadap wa / Hack Akun / Revengeporn - korban pemerasan vcs / terror
111
+
112
+ TIKTOK,GMAIL,TWITER,TELEGRAM,
113
+ FACEBOOK,INSTAGRAM
114
+ #revengeporn #zonauangᅠᅠᅠ
115
+ ☎️ https://t.co/K0AbW08qnU https://t.co/4IpWNA7a0z",
116
+ "💥Slot Gacor Hari ini Rute303
117
+ 💥Jaminan Jackpot Maxwin malam ini
118
+
119
+ LINK SLOT GACOR HARI INI : https://t.co/QvxjCAnt8o
120
+
121
+ Tags:
122
+ Jumbo #timsekop Jumat gratis ongkir Like Crazy PSIM https://t.co/ukuRdlvgGA"
123
+ ]
124
+
125
+ results = classifier(texts)
126
+
127
+ for text, result in zip(texts, results):
128
+ print(f"{text} -> {result['label']} ({result['score']:.4f})")
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 🏗️ Training Configuration
134
+
135
+ | Parameter | Value |
136
+ | ------------------ | ---------------- |
137
+ | Base Model | xlm-roberta-base |
138
+ | Training Samples | 22,243 |
139
+ | Validation Samples | 5,561 |
140
+ | Epochs | 3 |
141
+ | Learning Rate | 2e-5 |
142
+ | Batch Size | 16 |
143
+ | Training Date | 2026-01-21 |
144
+
145
+ ---
146
+
147
+ ## 🎯 Intended Use Cases
148
+
149
+ * Social media spam moderation
150
+ * Comment & post filtering
151
+ * Content quality control
152
+ * Pre-filtering for sentiment or topic analysis pipelines
153
+
154
+ ---
155
+
156
+ ## ⚠️ Limitations
157
+
158
+ * Binary classification only (Spam / Ham)
159
+ * Not optimized for non-social-media formal text
160
+ * Performance may degrade on very short or ambiguous messages
161
+
162
+ ---
163
+
164
+ ## 📜 License
165
+
166
+ Released under the **Apache 2.0 License**.
167
+ Free for commercial and research use.
168
+
169
+ ---
170
+
171
+ ## 📚 Citation
172
+
173
+ If you use this model in your work, please cite:
174
+
175
+ ```bibtex
176
+ @misc{djunaedi2026spam,
177
+ author = {AI/ML Engineer ADS Digital Partner},
178
+ title = {Spam Detection for Social Media Text},
179
+ year = {2025},
180
+ publisher = {Hugging Face},
181
+ url = {https://huggingface.co/nahiar/spam-detection-xlm-roberta-v1}
182
+ }
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 🙌 Acknowledgements
188
+
189
+ * Hugging Face Transformers
190
+ * Facebook AI Research — XLM-RoBERTa
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "XLMRobertaForSequenceClassification"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "dtype": "float32",
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 768,
13
+ "id2label": {
14
+ "0": "LABEL_0",
15
+ "1": "LABEL_1",
16
+ "2": "LABEL_2"
17
+ },
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 3072,
20
+ "label2id": {
21
+ "LABEL_0": 0,
22
+ "LABEL_1": 1,
23
+ "LABEL_2": 2
24
+ },
25
+ "layer_norm_eps": 1e-05,
26
+ "max_position_embeddings": 514,
27
+ "model_type": "xlm-roberta",
28
+ "num_attention_heads": 12,
29
+ "num_hidden_layers": 12,
30
+ "output_past": true,
31
+ "pad_token_id": 1,
32
+ "position_embedding_type": "absolute",
33
+ "problem_type": "single_label_classification",
34
+ "transformers_version": "4.57.6",
35
+ "type_vocab_size": 1,
36
+ "use_cache": true,
37
+ "vocab_size": 250002
38
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11f093db377f3b703cfc7118cdc9dd4e6cbcfb115199cfe864f8691344c6451d
3
+ size 1112208084
optimizer.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17ba7a4eee75dffa4ee00e5cdf62d8813b0e9fc0930c53087869f0f693b96f26
3
+ size 2224539019
rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f806cb7ce9eb8a3b06b4e9b29c4fedbba14df0bec195e5ab719d01674f52f80f
3
+ size 14645
scaler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fa0408efb69cab96d5bab9a1aaf44cedbc9fc8d34f4cef378d81605e5c026d5c
3
+ size 1383
scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4523e2a162c616b99308e8b035ccb377678042ed451ed80760c3fa70d406f39
3
+ size 1465
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ffb37461c391f096759f4a9bbbc329da0f36952f88bab061fcf84940c022e98
3
+ size 17082999
tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "model_max_length": 512,
51
+ "pad_token": "<pad>",
52
+ "sep_token": "</s>",
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }
trainer_state.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_global_step": 1800,
3
+ "best_metric": 0.8525679691676576,
4
+ "best_model_checkpoint": "../model/checkpoint-1800",
5
+ "epoch": 3.0,
6
+ "eval_steps": 500,
7
+ "global_step": 1800,
8
+ "is_hyper_param_search": false,
9
+ "is_local_process_zero": true,
10
+ "is_world_process_zero": true,
11
+ "log_history": [
12
+ {
13
+ "epoch": 1.0,
14
+ "grad_norm": 12.545402526855469,
15
+ "learning_rate": 1.3344444444444446e-05,
16
+ "loss": 0.593,
17
+ "step": 600
18
+ },
19
+ {
20
+ "epoch": 1.0,
21
+ "eval_accuracy": 0.828125,
22
+ "eval_f1_macro": 0.8270170775916136,
23
+ "eval_loss": 0.44877034425735474,
24
+ "eval_runtime": 24.45,
25
+ "eval_samples_per_second": 196.319,
26
+ "eval_steps_per_second": 3.067,
27
+ "step": 600
28
+ },
29
+ {
30
+ "epoch": 2.0,
31
+ "grad_norm": 13.457213401794434,
32
+ "learning_rate": 6.677777777777779e-06,
33
+ "loss": 0.3861,
34
+ "step": 1200
35
+ },
36
+ {
37
+ "epoch": 2.0,
38
+ "eval_accuracy": 0.8395833333333333,
39
+ "eval_f1_macro": 0.8393090159160851,
40
+ "eval_loss": 0.41652506589889526,
41
+ "eval_runtime": 24.3618,
42
+ "eval_samples_per_second": 197.029,
43
+ "eval_steps_per_second": 3.079,
44
+ "step": 1200
45
+ },
46
+ {
47
+ "epoch": 3.0,
48
+ "grad_norm": 22.19487190246582,
49
+ "learning_rate": 1.1111111111111112e-08,
50
+ "loss": 0.2759,
51
+ "step": 1800
52
+ },
53
+ {
54
+ "epoch": 3.0,
55
+ "eval_accuracy": 0.8527083333333333,
56
+ "eval_f1_macro": 0.8525679691676576,
57
+ "eval_loss": 0.436837762594223,
58
+ "eval_runtime": 24.3376,
59
+ "eval_samples_per_second": 197.226,
60
+ "eval_steps_per_second": 3.082,
61
+ "step": 1800
62
+ }
63
+ ],
64
+ "logging_steps": 500,
65
+ "max_steps": 1800,
66
+ "num_input_tokens_seen": 0,
67
+ "num_train_epochs": 3,
68
+ "save_steps": 500,
69
+ "stateful_callbacks": {
70
+ "TrainerControl": {
71
+ "args": {
72
+ "should_epoch_stop": false,
73
+ "should_evaluate": false,
74
+ "should_log": false,
75
+ "should_save": true,
76
+ "should_training_stop": true
77
+ },
78
+ "attributes": {}
79
+ }
80
+ },
81
+ "total_flos": 1.51553328611328e+16,
82
+ "train_batch_size": 32,
83
+ "trial_name": null,
84
+ "trial_params": null
85
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:228ed42715c963d674baf6116246ef1eb14a01f711a10c3c7682a24cc31b1141
3
+ size 5841