eliasalbouzidi commited on
Commit
d10f014
1 Parent(s): aa322d2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -30
README.md CHANGED
@@ -1,49 +1,89 @@
1
  ---
2
- license: mit
3
- base_model: roberta-base
4
- tags:
5
- - generated_from_trainer
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  metrics:
7
- - accuracy
8
  - f1
9
- - recall
10
  - precision
 
 
 
 
 
 
 
 
 
 
11
  model-index:
12
- - name: roberta-512-fbeta1.6-learning1
13
- results: []
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ---
 
 
 
15
 
16
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
17
- should probably proofread and complete it, then remove this comment. -->
18
 
19
- # roberta-512-fbeta1.6-learning1
20
 
21
- This model is a fine-tuned version of [roberta-base](https://huggingface.co/roberta-base) on the None dataset.
22
- It achieves the following results on the evaluation set:
23
- - Loss: 0.0723
24
- - Accuracy: 0.9825
25
- - F1: 0.9768
26
- - Recall: 0.9828
27
- - Precision: 0.9708
28
- - False positive rate: 0.0177
29
- - False negative rate: 0.0172
30
- - Fbeta 0.5: 0.9732
31
- - Fbeta 1.6: 0.9794
32
- - Fbeta 5: 0.9824
33
 
34
- ## Model description
 
 
35
 
36
- More information needed
 
 
 
37
 
38
- ## Intended uses & limitations
39
 
40
- More information needed
41
 
42
- ## Training and evaluation data
43
 
44
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- ## Training procedure
47
 
48
  ### Training hyperparameters
49
 
@@ -73,6 +113,7 @@ The following hyperparameters were used during training:
73
  | 0.0171 | 4.4992 | 26406 | 0.0975 | 0.9832 | 0.9777 | 0.9806 | 0.9748 | 0.0152 | 0.0194 | 0.9759 | 0.9790 | 0.9804 |
74
  | 0.0161 | 4.9991 | 29340 | 0.1046 | 0.9835 | 0.9781 | 0.9790 | 0.9772 | 0.0137 | 0.0210 | 0.9776 | 0.9785 | 0.9789 |
75
 
 
76
 
77
  ### Framework versions
78
 
@@ -80,3 +121,37 @@ The following hyperparameters were used during training:
80
  - Pytorch 2.3.0+cu121
81
  - Datasets 2.19.0
82
  - Tokenizers 0.19.1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ widget:
3
+ - text: A family hiking in the mountains
4
+ example_title: Safe
5
+ - text: A child playing with a puppy
6
+ example_title: Safe
7
+ - text: A couple kissing passionately in bed
8
+ example_title: Nsfw
9
+ - text: A woman naked
10
+ example_title: Nsfw
11
+ - text: A man killing people
12
+ example_title: Nsfw
13
+ - text: A mass shooting
14
+ example_title: Nsfw
15
+ license: apache-2.0
16
+
17
+ language:
18
+ - en
19
  metrics:
 
20
  - f1
21
+ - accuracy
22
  - precision
23
+ - recall
24
+ pipeline_tag: text-classification
25
+ tags:
26
+ - Transformers
27
+ - ' PyTorch'
28
+ - safety
29
+ - innapropriate
30
+ - roberta
31
+ datasets:
32
+ - eliasalbouzidi/NSFW-Safe-Dataset
33
  model-index:
34
+ - name: NSFW-Safe-Dataset
35
+ results:
36
+ - task:
37
+ name: Text Classification
38
+ type: text-classification
39
+ dataset:
40
+ name: NSFW-Safe-Dataset
41
+ type: .
42
+ metrics:
43
+ - name: F1
44
+ type: f1
45
+ value: 0.977
46
+ - name: Accuracy
47
+ type: accuracy
48
+ value: 0.982
49
  ---
50
+ # Model Card
51
+
52
+ This model is designed to categorize text into two classes: "safe", or "nsfw" (not safe for work), which makes it suitable for content moderation and filtering applications.
53
 
54
+ The model was trained using a dataset containing 190,000 labeled text samples, distributed among the two classes of "safe" and "nsfw".
 
55
 
56
+ The model is based on the roberta-base model.
57
 
58
+ In terms of performance, the model has achieved a score of 0.975 for F1 (40K exemples).
 
 
 
 
 
 
 
 
 
 
 
59
 
60
+ To improve the performance of the model, it is necessary to preprocess the input text. You can refer to the preprocess function in the app.py file in the following space: <https://huggingface.co/spaces/eliasalbouzidi/distilbert-nsfw-text-classifier>.
61
+ ### Model Description
62
+ The model can be used directly to classify text into one of the two classes. It takes in a string of text as input and outputs a probability distribution over the two classes. The class with the highest probability is selected as the predicted class.
63
 
64
+ - **Developed by:** Centrale Supélec Students
65
+ - **Model type:** 125M
66
+ - **Language(s) (NLP):** English
67
+ - **License:** apache-2.0
68
 
 
69
 
 
70
 
 
71
 
72
+ ### Uses
73
+
74
+ The model can be integrated into larger systems for content moderation or filtering.
75
+ ### Training Data
76
+ The training data for finetuning the text classification model consists of a large corpus of text labeled with one of the two classes: "safe" and "nsfw". The dataset contains a total of 190,000 examples, which are distributed as follows:
77
+
78
+ 117,000 examples labeled as "safe"
79
+
80
+ 63,000 examples labeled as "nsfw"
81
+
82
+ It was assembled by scraping data from the web and utilizing existing open-source datasets. A significant portion of the dataset consists of descriptions for images and scenes. The primary objective was to prevent diffusers from generating NSFW content but it can be used for other moderation purposes.
83
+
84
+ You can access the dataset : https://huggingface.co/datasets/eliasalbouzidi/NSFW-Safe-Dataset
85
+
86
 
 
87
 
88
  ### Training hyperparameters
89
 
 
113
  | 0.0171 | 4.4992 | 26406 | 0.0975 | 0.9832 | 0.9777 | 0.9806 | 0.9748 | 0.0152 | 0.0194 | 0.9759 | 0.9790 | 0.9804 |
114
  | 0.0161 | 4.9991 | 29340 | 0.1046 | 0.9835 | 0.9781 | 0.9790 | 0.9772 | 0.0137 | 0.0210 | 0.9776 | 0.9785 | 0.9789 |
115
 
116
+ We selected the checkpoint with the highest F-beta1.6 score.
117
 
118
  ### Framework versions
119
 
 
121
  - Pytorch 2.3.0+cu121
122
  - Datasets 2.19.0
123
  - Tokenizers 0.19.1
124
+
125
+ ### Out-of-Scope Use
126
+
127
+ It should not be used for any illegal activities.
128
+
129
+ ## Bias, Risks, and Limitations
130
+
131
+ The model may exhibit biases based on the training data used. It may not perform well on text that is written in languages other than English. It may also struggle with sarcasm, irony, or other forms of figurative language. The model may produce false positives or false negatives, which could lead to incorrect categorization of text.
132
+
133
+ ### Recommendations
134
+
135
+
136
+ Users should be aware of the limitations and biases of the model and use it accordingly. They should also be prepared to handle false positives and false negatives. It is recommended to fine-tune the model for specific downstream tasks and to evaluate its performance on relevant datasets.
137
+
138
+
139
+ ### Load model directly
140
+ ```python
141
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
142
+
143
+ tokenizer = AutoTokenizer.from_pretrained("eliasalbouzidi/roberta-nsfw-text-classifier")
144
+
145
+ model = AutoModelForSequenceClassification.from_pretrained("eliasalbouzidi/roberta-nsfw-text-classifier")
146
+
147
+ ```
148
+ ### Use a pipeline
149
+ ```python
150
+ from transformers import pipeline
151
+
152
+ pipe = pipeline("text-classification", model="eliasalbouzidi/roberta-nsfw-text-classifier")
153
+ ```
154
+
155
+
156
+ ## Contact
157
+ Please reach out to [email protected] if you have any questions or feedback.