đ German Toxic Comment Classification
This model is designed to detect toxic or potentially harmful comments in German.
đ Quick Start
This model is crafted to detect toxic or potentially harmful German comments. It fine - tunes a German DistilBERT model on a combination of five German datasets related to toxicity, profanity, offensive, or hate speech.
⨠Features
- Detects toxicity in German comments.
- Based on a fine - tuned German DistilBERT model.
đĻ Installation
No specific installation steps are provided in the original document.
đģ Usage Examples
Basic Usage
from transformers import pipeline
model_hub_url = 'https://huggingface.co/ml6team/distilbert-base-german-cased-toxic-comments'
model_name = 'ml6team/distilbert-base-german-cased-toxic-comments'
toxicity_pipeline = pipeline('text-classification', model=model_name, tokenizer=model_name)
comment = "Ein harmloses Beispiel"
result = toxicity_pipeline(comment)[0]
print(f"Comment: {comment}\nLabel: {result['label']}, score: {result['score']}")
đ Documentation
Model Description
This model was created with the purpose to detect toxic or potentially harmful comments.
For this model, we fine - tuned a German DistilBERT model distilbert - base - german - cased on a combination of five German datasets containing toxicity, profanity, offensive, or hate speech.
Intended Uses & Limitations
This model can be used to detect toxicity in German comments.
However, the definition of toxicity is vague and the model might not be able to detect all instances of toxicity.
It will not be able to detect toxicity in languages other than German.
Limitations and Bias
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.
Training Data
The training dataset combines the following five datasets:
- GermEval18 [[dataset](https://github.com/uds - lsv/GermEval - 2018 - Data)]
- Labels: abuse, profanity, toxicity
- GermEval21 [dataset]
- IWG Hatespeech dataset [paper, [dataset](https://github.com/UCSM - DUE/IWG_hatespeech_public)]
- Detecting Offensive Statements Towards Foreigners in Social Media (2017) by Breitschneider and Peters [[dataset](http://ub - web.de/research/)]
- HASOC: 2019 Hate Speech and Offensive Content [dataset]
- Labels: offensive, profanity, hate
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.
Note that the datasets vary substantially in the number of examples.
Training Procedure
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.
The model was trained for 2 epochs with the following arguments:
training_args = TrainingArguments(
per_device_train_batch_size=batch_size,
per_device_eval_batch_size=batch_size,
num_train_epochs=2,
evaluation_strategy="steps",
logging_strategy="steps",
logging_steps=100,
save_total_limit=5,
learning_rate=2e-5,
weight_decay=0.01,
metric_for_best_model='accuracy',
load_best_model_at_end=True
)
Evaluation Results
Model evaluation was done on 1/10th of the dataset, which served as the test dataset.
Accuracy |
F1 Score |
Recall |
Precision |
78.50 |
50.34 |
39.22 |
70.27 |
đ§ Technical Details
The model is based on fine - tuning a German DistilBERT model distilbert - base - german - cased on specific German datasets. The training and test set creation, as well as the training arguments, are described in the relevant sections.
đ License
No license information is provided in the original document.