Konstantin commited on
Commit
92d1f1c
1 Parent(s): 6e0ed9b

Update model card

Browse files
Files changed (1) hide show
  1. README.md +85 -1
README.md CHANGED
@@ -20,4 +20,88 @@ widget:
20
 
21
  # German Toxic Comment Classification
22
 
23
- The model was trained on the [GermEval21](https://github.com/germeval2021toxic/SharedTask/tree/main/Data%20Sets) and IWG Hatespeech dataset. [[paper](https://arxiv.org/pdf/1701.08118.pdf), [dataset](https://github.com/UCSM-DUE/IWG_hatespeech_public)]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  # German Toxic Comment Classification
22
 
23
+ ## Model Description
24
+
25
+ This model was created with the purpose to detect toxic or potentially harmful comments.
26
+
27
+ For this model, we fine-tuned a German DistilBERT model [distilbert-base-german-cased](https://huggingface.co/distilbert-base-german-cased) on a combination of five German datasets containing toxicity, profanity, offensive, or hate speech.
28
+
29
+
30
+ ## Intended Uses & Limitations
31
+
32
+ This model can be used to detect toxicity in German comments.
33
+ However, the definition of toxicity is vague and the model might not be able to detect all instances of toxicity.
34
+
35
+ It will not be able to detect toxicity in languages other than German.
36
+
37
+
38
+ ## How to Use
39
+
40
+ ```python
41
+ from transformers import pipeline
42
+
43
+ model_hub_url = 'https://huggingface.co/ml6team/distilbert-base-german-cased-toxic-comments'
44
+ model_name = 'ml6team/distilbert-base-german-cased-toxic-comments'
45
+
46
+ toxicity_pipeline = pipeline('text-classification', model=model_name, tokenizer=model_name)
47
+
48
+ comment = "Ein harmloses Beispiel"
49
+ result = toxicity_pipeline(comment)[0]
50
+ print(f"Comment: {comment}\nLabel: {result['label']}, score: {result['score']}")
51
+ ```
52
+
53
+
54
+ ## Limitations and Bias
55
+
56
+ The model was trained on a combinations of datasets that contain examples gathered from different social networks and internet communities. This only represents a narrow subset of possible instances of toxicity and instances in other domains might not be detected reliably.
57
+
58
+
59
+ ## Training Data
60
+
61
+ The training dataset combines the following five datasets:
62
+
63
+ * GermEval18 [[dataset](https://github.com/uds-lsv/GermEval-2018-Data)]
64
+ * Labels: abuse, profanity, toxicity
65
+ * GermEval21 [[dataset](https://github.com/germeval2021toxic/SharedTask/tree/main/Data%20Sets)]
66
+ * Labels: toxicity
67
+ * IWG Hatespeech dataset [[paper](https://arxiv.org/pdf/1701.08118.pdf), [dataset](https://github.com/UCSM-DUE/IWG_hatespeech_public)]
68
+ * Labels: hate speech
69
+ * Detecting Offensive Statements Towards Foreigners in Social Media (2017) by Breitschneider and Peters [[dataset](http://ub-web.de/research/)]
70
+ * Labels: hate
71
+ * HASOC: 2019 Hate Speech and Offensive Content [[dataset](https://hasocfire.github.io/hasoc/2019/index.html)]
72
+ * Labels: offensive, profanity, hate
73
+
74
+ The datasets contains different labels ranging from profanity, over hate speech to toxicity. In the combined dataset these labels were subsumed as `toxic` and `non-toxic` and contains 23,515 examples in total.
75
+
76
+ Note that the datasets vary substantially in the number of examples.
77
+
78
+
79
+ ## Training Procedure
80
+
81
+ The training and test set were created using either the predefined train/test splits where available and otherwise 80% of the examples for training and 20% for testing. This resulted in in 17,072 training examples and 6,443 test examples.
82
+
83
+ The model was trained for 2 epochs with the following arguments:
84
+
85
+ ```python
86
+ training_args = TrainingArguments(
87
+ per_device_train_batch_size=batch_size,
88
+ per_device_eval_batch_size=batch_size,
89
+ num_train_epochs=2,
90
+ evaluation_strategy="steps",
91
+ logging_strategy="steps",
92
+ logging_steps=100,
93
+ save_total_limit=5,
94
+ learning_rate=2e-5,
95
+ weight_decay=0.01,
96
+ metric_for_best_model='accuracy',
97
+ load_best_model_at_end=True
98
+ )
99
+ ```
100
+
101
+ ## Evaluation Results
102
+
103
+ Model evaluation was done on 1/10th of the dataset, which served as the test dataset.
104
+
105
+ | Accuracy | F1 Score | Recall | Precision |
106
+ | -------- | -------- | -------- | ----------- |
107
+ | 78.50 | 50.34 | 39.22 | 70.27 |