Downloads · 30 days
25
6% of all-time downloads
gorkem371/toxicity-classifier-xlmr-base-v3
toxicity-classifier-xlmr-base-v3 is a text classification model from gorkem371. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
Binary toxicity classifier for Turkish, Arabic, and English text, built on XLM-RoBERTa-base.
Downloads · 30 days
25
6% of all-time downloads
All-time downloads
396
Public
Parameters
278M
1.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors1.1 GB · 99%
From the Hugging Face model README
Binary toxicity classifier for Turkish, Arabic, and English text, built on XLM-RoBERTa-base.
| Property | Value |
|---|---|
| Base Model | xlm-roberta-base (280M params) |
| Task | Binary text classification (toxic / not-toxic) |
| Languages | Turkish, Arabic, English |
| Training Data | 105K balanced samples |
| Training | Focal loss, bf16, 15 epochs |
| Metric | Score |
|---|---|
| F1 | 91.3% |
| Accuracy | 91.2% |
| Stress Test | 97.7% (260/266) |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "gorkem371/toxicity-classifier-xlmr-base-v3"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
model.eval()
text = "You are a wonderful person!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)
prediction = torch.argmax(probs, dim=-1).item()
labels = {0: "not-toxic", 1: "toxic"}
print(f"Text: {text}")
print(f"Prediction: {labels[prediction]} (confidence: {probs[0][prediction]:.3f})")
Apache 2.0