This model is trained for toxicity classification task. The dataset used for training is the merge of the English parts of the three datasets by
Jigsaw (
Jigsaw 2018,
Jigsaw 2019,
Jigsaw 2020), containing around 2 million examples. We split it into two parts and fine-tune a RoBERTa model (
RoBERTa: A Robustly Optimized BERT Pretraining Approach) on it. The classifiers perform closely on the test set of the first Jigsaw competition, reaching the
AUC-ROC of 0.98 and
F1-score of 0.76.
1from transformers import RobertaTokenizer, RobertaForSequenceClassification
2
3# load tokenizer and model weights
4tokenizer = RobertaTokenizer.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier')
5model = RobertaForSequenceClassification.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier')
6
7# prepare the input
8batch = tokenizer.encode('you are amazing', return_tensors='pt')
9
10# inference
11model(batch)