Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- text-classification
|
| 6 |
+
- toxicity
|
| 7 |
+
- moderation
|
| 8 |
+
- chat
|
| 9 |
+
- bert
|
| 10 |
+
- pytorch
|
| 11 |
+
- onnx
|
| 12 |
+
datasets:
|
| 13 |
+
- dormlab/chat-corpus
|
| 14 |
+
metrics:
|
| 15 |
+
- accuracy
|
| 16 |
+
- f1
|
| 17 |
+
- precision
|
| 18 |
+
- recall
|
| 19 |
+
pipeline_tag: text-classification
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Toxic Chat Moderation
|
| 23 |
+
|
| 24 |
+
Binary classifier for real-time chat moderation. Flags toxic, hateful, harassing,
|
| 25 |
+
sexually explicit, and otherwise inappropriate messages in gaming and social chat.
|
| 26 |
+
|
| 27 |
+
Based on fine-tuned on 300K labeled chat messages.
|
| 28 |
+
|
| 29 |
+
## Quick use
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
## Performance
|
| 34 |
+
|
| 35 |
+
| Metric | Score |
|
| 36 |
+
|--------|-------|
|
| 37 |
+
| Accuracy | 0.9768 |
|
| 38 |
+
| F1 | 0.9768 |
|
| 39 |
+
| Precision | 0.9643 |
|
| 40 |
+
| Recall | 0.9897 |
|
| 41 |
+
|
| 42 |
+
ONNX INT8 latency: ~1-3ms on Apple Silicon (CoreML/MPS).
|
| 43 |
+
|
| 44 |
+
## Training
|
| 45 |
+
|
| 46 |
+
- **Architecture**: bert-base-uncased (110M params), 2 labels (clean/toxic)
|
| 47 |
+
- **Hardware**: Apple Silicon Mac Mini (MPS), single-node
|
| 48 |
+
- **Data**: 153K messages (122,688 train / 15,336 val / 15,336 test)
|
| 49 |
+
- **Framework**: PyTorch, HuggingFace Trainer
|
| 50 |
+
- **Export**: ONNX dynamic INT8 quantization (105 MB)
|
| 51 |
+
|
| 52 |
+
## Variants
|
| 53 |
+
|
| 54 |
+
This repo provides two model formats:
|
| 55 |
+
- — full PyTorch weights for use with usage: transformers <command> [<args>]
|
| 56 |
+
|
| 57 |
+
positional arguments:
|
| 58 |
+
{chat,convert,download,env,run,serve,add-new-model-like,add-fast-image-processor}
|
| 59 |
+
transformers command helpers
|
| 60 |
+
convert CLI tool to run convert model from original author
|
| 61 |
+
checkpoints to Transformers PyTorch checkpoints.
|
| 62 |
+
run Run a pipeline through the CLI
|
| 63 |
+
serve CLI tool to run inference requests through REST and
|
| 64 |
+
GraphQL endpoints.
|
| 65 |
+
|
| 66 |
+
options:
|
| 67 |
+
-h, --help show this help message and exit
|
| 68 |
+
- — ONNX INT8 quantized for fast inference on CPU/CoreML
|
| 69 |
+
|
| 70 |
+
## Label mapping
|
| 71 |
+
|
| 72 |
+
| Label | Meaning |
|
| 73 |
+
|--------|---------|
|
| 74 |
+
| 0 | Clean — allow |
|
| 75 |
+
| 1 | Toxic — block/flag |
|