eliasalbouzidi commited on
Commit
c3fe027
·
verified ·
1 Parent(s): 53602a1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -27
README.md CHANGED
@@ -1,47 +1,91 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
- base_model: distilbert/distilroberta-base
4
- tags:
5
- - generated_from_trainer
6
  metrics:
7
- - accuracy
8
  - f1
 
9
  - precision
10
  - recall
 
 
 
 
 
 
 
 
 
11
  model-index:
12
- - name: distilroberta-512-fbeta1.6
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
- # distilroberta-512-fbeta1.6
20
 
21
- This model is a fine-tuned version of [distilbert/distilroberta-base](https://huggingface.co/distilbert/distilroberta-base) on an unknown dataset.
22
- It achieves the following results on the evaluation set:
23
- - Loss: 0.0736
24
- - Accuracy: 0.9814
25
- - F1: 0.9752
26
- - Fbeta 1.6: 0.9766
27
- - False positive rate: 0.0169
28
- - False negative rate: 0.0216
29
- - Precision: 0.9721
30
- - Recall: 0.9784
31
 
32
- ## Model description
 
 
33
 
34
- More information needed
 
 
 
35
 
36
- ## Intended uses & limitations
37
 
38
- More information needed
39
 
40
- ## Training and evaluation data
41
 
42
- More information needed
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- ## Training procedure
45
 
46
  ### Training hyperparameters
47
 
@@ -90,7 +134,7 @@ The following hyperparameters were used during training:
90
  | 0.0433 | 2.7957 | 16408 | 0.0783 | 0.9814 | 0.9751 | 0.9733 | 0.0125 | 0.0289 | 0.9790 | 0.9711 |
91
  | 0.0398 | 2.8956 | 16994 | 0.0736 | 0.9814 | 0.9752 | 0.9766 | 0.0169 | 0.0216 | 0.9721 | 0.9784 |
92
  | 0.0431 | 2.9954 | 17580 | 0.0757 | 0.9816 | 0.9754 | 0.9757 | 0.0151 | 0.0240 | 0.9749 | 0.9760 |
93
-
94
 
95
  ### Framework versions
96
 
@@ -98,3 +142,37 @@ The following hyperparameters were used during training:
98
  - Pytorch 2.3.0+cu121
99
  - Datasets 2.19.0
100
  - 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
+ - distiroberta
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.975
46
+ - name: Accuracy
47
+ type: accuracy
48
+ value: 0.981
49
  ---
50
+ # Model Card
51
+
52
+ <!-- Provide a quick summary of what the model is/does. -->
53
+
54
+ 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.
55
 
56
+ The model was trained using a dataset containing 190,000 labeled text samples, distributed among the two classes of "safe" and "nsfw".
 
57
 
58
+ The model is based on the Distilroberta-base model.
59
 
60
+ In terms of performance, the model has achieved a score of 0.975 for F1 (40K exemples).
 
 
 
 
 
 
 
 
 
61
 
62
+ 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>.
63
+ ### Model Description
64
+ 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.
65
 
66
+ - **Developed by:** Centrale Supélec Students
67
+ - **Model type:** 82M
68
+ - **Language(s) (NLP):** English
69
+ - **License:** apache-2.0
70
 
 
71
 
 
72
 
 
73
 
74
+ ### Uses
75
+
76
+ The model can be integrated into larger systems for content moderation or filtering.
77
+ ### Training Data
78
+ 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:
79
+
80
+ 117,000 examples labeled as "safe"
81
+
82
+ 63,000 examples labeled as "nsfw"
83
+
84
+ 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.
85
+
86
+ You can access the dataset : https://huggingface.co/datasets/eliasalbouzidi/NSFW-Safe-Dataset
87
+
88
 
 
89
 
90
  ### Training hyperparameters
91
 
 
134
  | 0.0433 | 2.7957 | 16408 | 0.0783 | 0.9814 | 0.9751 | 0.9733 | 0.0125 | 0.0289 | 0.9790 | 0.9711 |
135
  | 0.0398 | 2.8956 | 16994 | 0.0736 | 0.9814 | 0.9752 | 0.9766 | 0.0169 | 0.0216 | 0.9721 | 0.9784 |
136
  | 0.0431 | 2.9954 | 17580 | 0.0757 | 0.9816 | 0.9754 | 0.9757 | 0.0151 | 0.0240 | 0.9749 | 0.9760 |
137
+ We selected the checkpoint with the highest F-beta1.6 score.
138
 
139
  ### Framework versions
140
 
 
142
  - Pytorch 2.3.0+cu121
143
  - Datasets 2.19.0
144
  - Tokenizers 0.19.1
145
+
146
+ ### Out-of-Scope Use
147
+
148
+ It should not be used for any illegal activities.
149
+
150
+ ## Bias, Risks, and Limitations
151
+
152
+ 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.
153
+
154
+ ### Recommendations
155
+
156
+
157
+ 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.
158
+
159
+
160
+ ### Load model directly
161
+ ```python
162
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
163
+
164
+ tokenizer = AutoTokenizer.from_pretrained("eliasalbouzidi/distilroberta-nsfw-text-classifier")
165
+
166
+ model = AutoModelForSequenceClassification.from_pretrained("eliasalbouzidi/distilroberta-nsfw-text-classifier")
167
+
168
+ ```
169
+ ### Use a pipeline
170
+ ```python
171
+ from transformers import pipeline
172
+
173
+ pipe = pipeline("text-classification", model="eliasalbouzidi/distilroberta-nsfw-text-classifier")
174
+ ```
175
+
176
+
177
+ ## Contact
178
+ Please reach out to [email protected] if you have any questions or feedback.