Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: sw
|
| 4 |
+
tags:
|
| 5 |
+
- hate-speech
|
| 6 |
+
- swahili
|
| 7 |
+
- text-classification
|
| 8 |
+
- bert
|
| 9 |
+
- offensive-language
|
| 10 |
+
- political-hate-speech
|
| 11 |
+
datasets:
|
| 12 |
+
- custom
|
| 13 |
+
pipeline_tag: text-classification
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Swahili Hate Speech Classification Model
|
| 17 |
+
|
| 18 |
+
This is a fine-tuned BERT model for **multi-class text classification** in Swahili. It predicts whether a given text is:
|
| 19 |
+
|
| 20 |
+
- **Non-hate speech**
|
| 21 |
+
- **Political hate speech**
|
| 22 |
+
- **Offensive language**
|
| 23 |
+
|
| 24 |
+
## 🧠 Model Details
|
| 25 |
+
|
| 26 |
+
- **Architecture**: BERT (base)
|
| 27 |
+
- **Languages**: Swahili
|
| 28 |
+
- **Classes**: 3
|
| 29 |
+
- **Model size**: 178M parameters
|
| 30 |
+
- **Framework**: PyTorch
|
| 31 |
+
- **Training data**: A custom labeled dataset of Swahili social media or online comments (non-public)
|
| 32 |
+
|
| 33 |
+
## 🏷️ Labels
|
| 34 |
+
|
| 35 |
+
| Label ID | Class Name |
|
| 36 |
+
|----------|--------------------------|
|
| 37 |
+
| `LABEL_0` | Non-hate speech |
|
| 38 |
+
| `LABEL_1` | Political hate speech |
|
| 39 |
+
| `LABEL_2` | Offensive language |
|
| 40 |
+
|
| 41 |
+
## 🚀 Usage
|
| 42 |
+
|
| 43 |
+
You can load and test the model using the `transformers` library:
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from transformers import pipeline
|
| 47 |
+
|
| 48 |
+
classifier = pipeline("text-classification", model="sandbox338/hatespeech")
|
| 49 |
+
|
| 50 |
+
result = classifier("Hii ni ujumbe wa kawaida bila matusi.")
|
| 51 |
+
print(result) # [{'label': 'LABEL_0', 'score': 0.98}]
|