Rajkumar57 commited on
Commit
1f58e2d
·
verified ·
1 Parent(s): 893ec9d

Upload 6 files

Browse files
Files changed (6) hide show
  1. Readme.md +54 -0
  2. config.json +27 -0
  3. model.safetensors +3 -0
  4. special_tokens_map.json +7 -0
  5. tokenizer_config.json +57 -0
  6. vocab.txt +0 -0
Readme.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - spam
4
+ - classification
5
+ - bert
6
+ - pytorch
7
+ - comment-filter
8
+ - text-classification
9
+ - content-moderation
10
+ - social-media
11
+ license: mit
12
+ language: en
13
+ datasets: custom
14
+ widget:
15
+ - text: "Click here to win a free iPhone!"
16
+ - text: "Great video, thanks for sharing!"
17
+ - text: "Follow me for daily crypto tips 💰"
18
+ - text: "This tutorial saved my life, thank you!"
19
+ - text: "🔥 Get rich quick! Limited-time offer!"
20
+ ---
21
+
22
+ # 📦 Spam Detector — `vibehq/spam-detector`
23
+
24
+ A BERT-based spam classifier fine-tuned to detect **spam and promotional content** in social media-style comments. Trained on real-world-like comment data including giveaways, scams, promotions, and genuine engagement.
25
+
26
+ Perfect for content moderation on platforms like:
27
+ - YouTube
28
+ - Instagram
29
+ - Discord
30
+ - Reddit
31
+ - Facebook
32
+ - Forums or blogs
33
+
34
+ ---
35
+
36
+ ## 🚀 How to Use
37
+
38
+ ```python
39
+ from transformers import BertTokenizer, BertForSequenceClassification
40
+ import torch
41
+
42
+ # Load model and tokenizer
43
+ model = BertForSequenceClassification.from_pretrained("vibehq/spam-detector")
44
+ tokenizer = BertTokenizer.from_pretrained("vibehq/spam-detector")
45
+
46
+ def predict_spam(comment):
47
+ inputs = tokenizer(comment, return_tensors='pt', max_length=128, padding='max_length', truncation=True)
48
+ with torch.no_grad():
49
+ outputs = model(**inputs)
50
+ prediction = torch.argmax(outputs.logits, dim=-1).item()
51
+ return "Spam" if prediction == 1 else "Non-Spam"
52
+
53
+ # Example
54
+ print(predict_spam("Subscribe to my channel for more giveaways!"))
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "bert-base-uncased",
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "classifier_dropout": null,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 12,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "problem_type": "single_label_classification",
22
+ "torch_dtype": "float32",
23
+ "transformers_version": "4.42.4",
24
+ "type_vocab_size": 2,
25
+ "use_cache": true,
26
+ "vocab_size": 30522
27
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2dd8290f439effc74bf3a741c818e884dfda04ab05caf189bdd8dc0aa02e45cb
3
+ size 437958648
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": true,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "never_split": null,
51
+ "pad_token": "[PAD]",
52
+ "sep_token": "[SEP]",
53
+ "strip_accents": null,
54
+ "tokenize_chinese_chars": true,
55
+ "tokenizer_class": "BertTokenizer",
56
+ "unk_token": "[UNK]"
57
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff