Hate-speech-CNERG/hatexplain
Updated • 2.43k • 22
How to use TaiwoOgun/minilm-hate-speech-onnx with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="TaiwoOgun/minilm-hate-speech-onnx") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("TaiwoOgun/minilm-hate-speech-onnx")
model = AutoModelForSequenceClassification.from_pretrained("TaiwoOgun/minilm-hate-speech-onnx")How to use TaiwoOgun/minilm-hate-speech-onnx with Transformers.js:
// npm i @huggingface/transformers
import { pipeline } from '@huggingface/transformers';
// Allocate pipeline
const pipe = await pipeline('text-classification', 'TaiwoOgun/minilm-hate-speech-onnx');Fine-tuned MiniLM-L12 model for binary hate speech detection, optimized for browser deployment.
This model classifies text as either hate speech or not hate speech (binary classification). It was fine-tuned on the HateXplain dataset and exported to ONNX format with INT8 quantization for efficient on-device inference in browser extensions.
hate (1): Hate speechnot_hate (0): Offensive + Normal content merged| Metric | Score |
|---|---|
| F1 (Macro) | 0.8302 |
| Accuracy | 0.8567 |
| Precision | 0.8342 |
| Recall | 0.8266 |
| Model | F1 | Size (Quantized) |
|---|---|---|
| MiniLM (this) | 0.830 | 32.6 MB |
| DistilBERT | 0.825 | 64 MB |
| TinyBERT | 0.816 | 15 MB |
import { pipeline } from '@huggingface/transformers';
const classifier = await pipeline(
'text-classification',
'TaiwoOgun/minilm-hate-speech-onnx'
);
const result = await classifier('Some text to classify');
console.log(result);
// [{ label: 'hate', score: 0.85 }]
from transformers import pipeline
classifier = pipeline('text-classification', 'TaiwoOgun/minilm-hate-speech')
result = classifier('Some text to classify')
If you use this model, please cite:
@misc{ogunbanwo2025hatespeech,
author = {Ogunbanwo, Taiwo},
title = {Real-Time Hate Speech Detection Browser Extension},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/TaiwoOgun/minilm-hate-speech-onnx}
}
MIT License