Downloads · 30 days
11
9% of all-time downloads
Jaanhavi/toxicity-classifier-2
toxicity-classifier-2 is a text classification model from Jaanhavi. Use it when you need a label for a piece of text. It is set up for transformers.
A fine-tuned DistilRoBERTa model for detecting toxic comments in text. Trained on Civil Comments and Real Toxicity Prompts datasets with balanced class distribution (50k toxic + 50k non-toxic examples).
Downloads · 30 days
11
9% of all-time downloads
All-time downloads
124
Public
Parameters
82.1M
657 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors328 MB · 99%
From the Hugging Face model README
A fine-tuned DistilRoBERTa model for detecting toxic comments in text. Trained on Civil Comments and Real Toxicity Prompts datasets with balanced class distribution (50k toxic + 50k non-toxic examples).
from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained("Jaanhavi/toxicity-classifier")
tokenizer = AutoTokenizer.from_pretrained("Jaanhavi/toxicity-classifier")
from transformers import pipeline
classifier = pipeline("text-classification", model="Jaanhavi/toxicity-classifier")
text = "You are so stupid and worthless"
result = classifier(text)
print(result)
# Output: [{'label': 'LABEL_1', 'score': 0.9980}]
# LABEL_0 = Non-toxic, LABEL_1 = Toxic
Tested on 10,000 diverse examples with 90.88% overall accuracy.
Examples: