Views
No views yet
| 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) |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "gorkem371/toxicity-classifier-xlmr-base-v3"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7model.eval()
8
9text = "You are a wonderful person!"
10inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256)
11
12with torch.no_grad():
13 outputs = model(**inputs)
14 probs = torch.softmax(outputs.logits, dim=-1)
15 prediction = torch.argmax(probs, dim=-1).item()
16
17labels = {0: "not-toxic", 1: "toxic"}
18print(f"Text: {text}")
19print(f"Prediction: {labels[prediction]} (confidence: {probs[0][prediction]:.3f})")