File size: 1,751 Bytes
037dca5
 
 
6f080c5
00eacca
 
 
 
 
037dca5
 
 
 
6f080c5
8d2e4ef
 
 
037dca5
 
 
 
 
 
2e2ce7e
037dca5
 
 
 
 
 
 
 
 
 
 
 
 
abb2395
037dca5
 
 
 
 
 
2e2ce7e
037dca5
93f2ed2
037dca5
00eacca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
language:
- en
license: apache-2.0
tags:
- toxic
- toxicity
- offensive language
- hate speech
---

# Text Classification GoEmotions

This model is a fined-tuned version of [MiniLMv2-L6-H384](https://huggingface.co/nreimers/MiniLMv2-L6-H384-distilled-from-BERT-Large) on the on the [Jigsaw 1st Kaggle competition](https://www.kaggle.com/competitions/jigsaw-toxic-comment-classification-challenge) dataset using [unitary/toxic-bert](https://huggingface.co/unitary/toxic-bert) as teacher model.
The quantized version in ONNX format can be found [here](https://huggingface.co/minuva/MiniLMv2-toxic-jigsaw-onnx). 

The model with two labels only (toxicity and severe toxicity) is [here](https://huggingface.co/minuva/MiniLMv2-toxic-jigsaw-lite)

# Load the Model

```py
from transformers import pipeline

pipe = pipeline(model='minuva/MiniLMv2-toxic-jigsaw', task='text-classification')
pipe("This is pure trash")
# [{'label': 'toxic', 'score': 0.9383478164672852}]
```

# Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 6e-05
- train_batch_size: 48
- eval_batch_size: 48
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10
- warmup_ratio: 0.1


# Metrics (comparison with teacher model)

| Teacher (params)    |   Student (params)     | Set  (metric)     | Score (teacher)    |    Score (student)      |
|--------------------|-------------|----------|--------| --------|
| unitary/toxic-bert (110M) |  MiniLMv2-toxic-jigsaw (23M)  | Test (ROC_AUC)  | 0.98636 |  0.98600 |

# Deployment

Check out [fast-nlp-text-toxicity repository](https://github.com/minuva/fast-nlp-text-toxicity) for a FastAPI based server to deploy this model in CPU devices.