AnnyNguyen commited on
Commit
53ed583
·
verified ·
1 Parent(s): 1be2b57

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +157 -0
README.md ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: unknown
4
+ tags:
5
+ - vietnamese
6
+ - hate-speech-detection
7
+ - text-classification
8
+ - offensive-language-detection
9
+ datasets:
10
+ - visolex/vihsd
11
+ metrics:
12
+ - accuracy
13
+ - macro-f1
14
+ - weighted-f1
15
+ model-index:
16
+ - name: textcnn-hsd
17
+ results:
18
+ - task:
19
+ type: text-classification
20
+ name: Hate Speech Detection
21
+ dataset:
22
+ name: ViHSD
23
+ type: hate-speech-detection
24
+ metrics:
25
+ - type: accuracy
26
+ value: 0.8388
27
+ - type: macro-f1
28
+ value: 0.3041
29
+ - type: weighted-f1
30
+ value: 0.7652
31
+ - type: macro-precision
32
+ value: 0.2796
33
+ - type: macro-recall
34
+ value: 0.3333
35
+ ---
36
+
37
+ # TEXTCNN: Hate Speech Detection for Vietnamese Text
38
+
39
+ This model is a fine-tuned version of [unknown](https://huggingface.co/unknown)
40
+ on the **ViHSD (Vietnamese Hate Speech Detection Dataset)** for classifying Vietnamese text into three categories: CLEAN, OFFENSIVE, and HATE.
41
+
42
+ ## Model Details
43
+
44
+ * **Base Model**: unknown
45
+ * **Description**: textcnn fine-tuned for Vietnamese Hate Speech Detection
46
+ * **Architecture**: Unknown
47
+ * **Dataset**: ViHSD (Vietnamese Hate Speech Detection Dataset)
48
+ * **Fine-tuning Framework**: HuggingFace Transformers + PyTorch
49
+ * **Task**: Hate Speech Classification (3 classes)
50
+
51
+ ### Hyperparameters
52
+
53
+ * **Batch size**: `32`
54
+ * **Learning rate**: `2e-5`
55
+ * **Epochs**: `100`
56
+ * **Max sequence length**: `256`
57
+ * **Weight decay**: `0.01`
58
+ * **Warmup steps**: `500`
59
+ * **Early stopping patience**: `5`
60
+ * **Optimizer**: AdamW
61
+ * **Learning rate scheduler**: Cosine with warmup
62
+
63
+ ## Dataset
64
+
65
+ Model was trained on **ViHSD (Vietnamese Hate Speech Detection Dataset)** containing ~10,000 Vietnamese comments from social media.
66
+
67
+ ### Label Distribution:
68
+
69
+ - **CLEAN (0)**: CLEAN
70
+ - **OFFENSIVE (1)**: OFFENSIVE
71
+ - **HATE (2)**: HATE
72
+
73
+ ### Label Descriptions:
74
+
75
+ * **CLEAN (0)**: Normal content without offensive language
76
+ * **OFFENSIVE (1)**: Mildly offensive or inappropriate content
77
+ * **HATE (2)**: Hate speech, extremist language, severe threats
78
+
79
+ ## Evaluation Results
80
+
81
+ The model was evaluated on test set with the following metrics:
82
+
83
+ * **Accuracy**: `0.8388`
84
+ * **Macro-F1**: `0.3041`
85
+ * **Weighted-F1**: `0.7652`
86
+ * **Macro-Precision**: `0.2796`
87
+ * **Macro-Recall**: `0.3333`
88
+
89
+ ### Basic Usage
90
+
91
+ ```python
92
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
93
+ import torch
94
+
95
+ # Load model and tokenizer
96
+ model_name = "visolex/textcnn-hsd"
97
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
98
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
99
+
100
+ # Classify text
101
+ text = "Văn bản tiếng Việt cần phân loại"
102
+ inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
103
+
104
+ with torch.no_grad():
105
+ outputs = model(**inputs)
106
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
107
+ predicted_label = torch.argmax(predictions, dim=-1).item()
108
+
109
+ # Label mapping
110
+ label_names = {
111
+ 0: "CLEAN",
112
+ 1: "OFFENSIVE",
113
+ 2: "HATE"
114
+ }
115
+
116
+ print(f"Predicted label: {label_names[predicted_label]}")
117
+ print(f"Confidence scores: {predictions[0].tolist()}")
118
+ ```
119
+
120
+ ## Training Details
121
+
122
+ ### Training Data
123
+ - **Dataset**: ViHSD (Vietnamese Hate Speech Detection Dataset)
124
+ - **Total samples**: ~10,000 Vietnamese comments from social media
125
+ - **Training split**: ~70%
126
+ - **Validation split**: ~15%
127
+ - **Test split**: ~15%
128
+
129
+ ### Training Configuration
130
+ - **Framework**: PyTorch + HuggingFace Transformers
131
+ - **Optimizer**: AdamW
132
+ - **Learning Rate**: 2e-5
133
+ - **Batch Size**: 32
134
+ - **Max Length**: 256 tokens
135
+ - **Epochs**: 100 (with early stopping patience: 5)
136
+ - **Weight Decay**: 0.01
137
+ - **Warmup Steps**: 500
138
+
139
+
140
+ ## Contact & Support
141
+
142
+ - **GitHub**: [ViSoLex Hate Speech Detection](https://github.com/visolex/hate-speech-detection)
143
+ - **Issues**: [Report Issues](https://github.com/visolex/hate-speech-detection/issues)
144
+ - **Questions**: Open a discussion on the model's Hugging Face page
145
+
146
+ ## License
147
+
148
+ This model is distributed under the MIT License.
149
+
150
+ ## Acknowledgments
151
+
152
+ - Base model: [unknown](https://huggingface.co/unknown)
153
+ - Dataset: ViHSD (Vietnamese Hate Speech Detection Dataset)
154
+ - Framework: [Hugging Face Transformers](https://huggingface.co/transformers)
155
+ - ViSoLex Toolkit
156
+
157
+ ---