dardem commited on
Commit
d0245be
·
verified ·
1 Parent(s): 3076e58

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -12
README.md CHANGED
@@ -5,25 +5,56 @@ tags:
5
  - toxic comments classification
6
  licenses:
7
  - cc-by-nc-sa
 
 
 
 
 
8
  ---
9
  ## Toxicity Classification Model (but for the first part of the data)
10
  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](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge), [Jigsaw 2019](https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification), [Jigsaw 2020](https://www.kaggle.com/c/jigsaw-multilingual-toxic-comment-classification)), containing around 2 million examples. We split it into two parts and fine-tune a RoBERTa model ([RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692)) on it. THIS MODEL WAS FINE-TUNED ON THE FIRST PART. 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.
 
11
  ## How to use
12
  ```python
 
13
  from transformers import RobertaTokenizer, RobertaForSequenceClassification
14
- # load tokenizer and model weights, but be careful, here we need to use auth token
15
- tokenizer = RobertaTokenizer.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier', use_auth_token=True)
16
- model = RobertaForSequenceClassification.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier', use_auth_token=True)
17
- # prepare the input
18
- batch = tokenizer.encode('you are amazing', return_tensors='pt')
19
- # inference
20
- model(batch)
 
 
21
  ```
22
- ## Licensing Information
23
 
24
- [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][cc-by-nc-sa].
25
 
26
- [![CC BY-NC-SA 4.0][cc-by-nc-sa-image]][cc-by-nc-sa]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- [cc-by-nc-sa]: http://creativecommons.org/licenses/by-nc-sa/4.0/
29
- [cc-by-nc-sa-image]: https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png
 
5
  - toxic comments classification
6
  licenses:
7
  - cc-by-nc-sa
8
+ license: openrail++
9
+ datasets:
10
+ - google/jigsaw_toxicity_pred
11
+ base_model:
12
+ - FacebookAI/xlm-roberta-large
13
  ---
14
  ## Toxicity Classification Model (but for the first part of the data)
15
  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](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge), [Jigsaw 2019](https://www.kaggle.com/c/jigsaw-unintended-bias-in-toxicity-classification), [Jigsaw 2020](https://www.kaggle.com/c/jigsaw-multilingual-toxic-comment-classification)), containing around 2 million examples. We split it into two parts and fine-tune a RoBERTa model ([RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692)) on it. THIS MODEL WAS FINE-TUNED ON THE FIRST PART. 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.
16
+
17
  ## How to use
18
  ```python
19
+ import torch
20
  from transformers import RobertaTokenizer, RobertaForSequenceClassification
21
+
22
+ tokenizer = RobertaTokenizer.from_pretrained('s-nlp/roberta_first_toxicity_classifier')
23
+ model = RobertaForSequenceClassification.from_pretrained('s-nlp/roberta_first_toxicity_classifier')
24
+
25
+ batch = tokenizer.encode("You are amazing!", return_tensors="pt")
26
+
27
+ output = model(batch)
28
+ predicted_label = torch.sigmoid(output.logits).argmax().item()
29
+ # 0 for neutral, 1 for toxic
30
  ```
 
31
 
32
+ ## Citation
33
 
34
+ To acknowledge our work, please, use the corresponding citation:
35
+
36
+ ```
37
+ @inproceedings{logacheva-etal-2022-paradetox,
38
+ title = "{P}ara{D}etox: Detoxification with Parallel Data",
39
+ author = "Logacheva, Varvara and
40
+ Dementieva, Daryna and
41
+ Ustyantsev, Sergey and
42
+ Moskovskiy, Daniil and
43
+ Dale, David and
44
+ Krotova, Irina and
45
+ Semenov, Nikita and
46
+ Panchenko, Alexander",
47
+ booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
48
+ month = may,
49
+ year = "2022",
50
+ address = "Dublin, Ireland",
51
+ publisher = "Association for Computational Linguistics",
52
+ url = "https://aclanthology.org/2022.acl-long.469",
53
+ pages = "6804--6818",
54
+ abstract = "We present a novel pipeline for the collection of parallel data for the detoxification task. We collect non-toxic paraphrases for over 10,000 English toxic sentences. We also show that this pipeline can be used to distill a large existing corpus of paraphrases to get toxic-neutral sentence pairs. We release two parallel corpora which can be used for the training of detoxification models. To the best of our knowledge, these are the first parallel datasets for this task.We describe our pipeline in detail to make it fast to set up for a new language or domain, thus contributing to faster and easier development of new parallel resources.We train several detoxification models on the collected data and compare them with several baselines and state-of-the-art unsupervised approaches. We conduct both automatic and manual evaluations. All models trained on parallel data outperform the state-of-the-art unsupervised models by a large margin. This suggests that our novel datasets can boost the performance of detoxification systems.",
55
+ }
56
+ ```
57
+
58
+ ## Licensing Information
59
 
60
+ This model is licensed under the OpenRAIL++ License, which supports the development of various technologies—both industrial and academic—that serve the public good.