Jensvollends commited on
Commit
d369ee2
·
verified ·
1 Parent(s): 88d0a2f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -0
README.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ tags:
4
+ - hate-speech
5
+ - toxic-comments
6
+ - classification
7
+ - hatebert
8
+ - jigsaw
9
+ - fine-tuned
10
+ base_model: GroNLP/hateBERT
11
+ datasets:
12
+ - jigsaw-toxic-comment-classification-challenge
13
+ metrics:
14
+ - accuracy
15
+ - f1
16
+ ---
17
+
18
+ # HateBERT Fine-Tuned on Jigsaw Toxic Comments (v5)
19
+
20
+ This model is a fine-tuned version of [GroNLP/hateBERT](https://huggingface.co/GroNLP/hateBERT) on a binary version of the [Jigsaw Toxic Comment Classification Challenge](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge) dataset.
21
+
22
+ It has been fine-tuned to detect whether a comment is toxic (`1`) or non-toxic (`0`) using class-weighted Focal Loss and evaluation strategies suitable for imbalanced classification tasks.
23
+
24
+ ## 💻 Training Setup
25
+
26
+ - **Base Model:** GroNLP/hateBERT
27
+ - **Dataset:** Jigsaw Toxic Comment Classification Challenge
28
+ - **Binary Labeling:** A comment is marked as *toxic* if any of the following labels is `1`: `toxic`, `severe_toxic`, `obscene`, `threat`, `insult`, `identity_hate`
29
+ - **Tokenizer Max Length:** 256
30
+ - **Loss Function:** Focal Loss with class weights
31
+ - **Hardware:** NVIDIA H100 GPU (via SLURM on TU Berlin HPC)
32
+ - **Training Time:** ~6 hours
33
+ - **Final F1 Score (Validation):** `0.850`
34
+
35
+ ## 📊 Evaluation Metrics
36
+
37
+ | Metric | Value |
38
+ |----------|--------|
39
+ | F1 Score | 0.850 |
40
+ | Accuracy | ~0.84 |
41
+ | Confusion Matrix & PR Curves | [Saved and visualized during training] |
42
+
43
+ ## 🧪 How to Use
44
+
45
+ ```python
46
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
47
+
48
+ model = AutoModelForSequenceClassification.from_pretrained("Jensvollends/hatebert-finetuned_v5")
49
+ tokenizer = AutoTokenizer.from_pretrained("Jensvollends/hatebert-finetuned_v5")
50
+
51
+ pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, top_k=None)
52
+
53
+ text = "You are a kind person"
54
+ result = pipe(text)
55
+ print(result)