Views
No views yet
GPTNeoForSequenceClassification head fine-tuned on the Jigsaw Toxic Comment
Classification corpus. It outputs a continuous P(toxic) ∈ [0, 1] for a piece
of English text (softmax probability of the toxic class, label index 1).softmax(logits)[1] = P(toxic).1import torch
2from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
4repo = "TheSky0908/gpt-neo-1.3B-toxicity-surrogate"
5tok = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForSequenceClassification.from_pretrained(repo).eval()
7
8text = "I hope you have a wonderful day."
9enc = tok(text, return_tensors="pt", truncation=True, max_length=256)
10with torch.no_grad():
11 p_toxic = torch.softmax(model(**enc).logits, dim=-1)[0, 1].item()
12print(f"P(toxic) = {p_toxic:.4f}")Arsive/toxicity_classification_jigsaw.
The six Jigsaw sub-labels (toxic, severe_toxic, obscene, threat,
insult, identity_hate) are consolidated into a single binary target:
label 1 if any sub-label is positive, else 0.EleutherAI/gpt-neo-1.3B, 2-way sequence-classification head.1e-5, weight decay 0.01, linear schedule with 6% warmup, grad-clip 1.0.| Metric | Value |
|---|---|
| F1 | 0.9885 |
| Accuracy | 0.9886 |
| ROC-AUC | 0.9986 |
| Precision | 0.9855 |
| Recall | 0.9916 |