Views
No views yet
HateXplain dataset and evaluated against an out-of-domain (OOD) dataset (Davidson) to test for real-world generalization. It was the clear winner against four other models (BERT, DistilBERT, RoBERTa, XLM-RoBERTa).| model | F1 (In-Domain) | F1 (Out-of-Domain) | Accuracy (In-Domain) | Accuracy (Out-of-Domain) |
|---|---|---|---|---|
| DeBERTa-v3 (This Model) | 83.19% | 92.86% | 78.78% | 87.98% |
| BERT | 83.48% | 81.68% | 79.70% | 73.05% |
| DistilBERT | 83.13% | 80.01% | 78.68% | 71.22% |
| RoBERTa | 82.37% | 76.38% | 78.78% | 66.56% |
| XLM-RoBERTa | 81.58% | 66.69% | 77.59% | 56.36% |
optimum library.1from transformers import AutoTokenizer
2from optimum.onnxruntime import ORTModelForSequenceClassification, pipeline
3
4# Load the ONNX model and tokenizer from the Hub
5repo_id = "TaiwoOgun/deberta-v3-hate-speech-onnx"
6model = ORTModelForSequenceClassification.from_pretrained(repo_id)
7tokenizer = AutoTokenizer.from_pretrained(repo_id)
8
9# Create the pipeline
10classifier = pipeline(
11 "text-classification",
12 model=model,
13 tokenizer=tokenizer
14)
15
16# Run inference
17texts = [
18 "This is a wonderful, positive statement.",
19 "Go back to where you came from."
20]
21
22predictions = classifier(texts)
23print(predictions)
24# [{'label': 'NOT_HATE', 'score': 0.8...},
25# {'label': 'NOT_HATE', 'score': 0.8...}]