File size: 4,102 Bytes
e91d765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720e0a3
e91d765
720e0a3
e91d765
 
 
328d210
e91d765
 
 
 
 
 
 
7fd5711
e91d765
 
 
 
 
 
 
 
 
 
720e0a3
e91d765
f81e707
e91d765
f81e707
e91d765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
widget:
- text: A family hiking in the mountains
  example_title: Safe
- text: A child playing with a puppy
  example_title: Safe
- text: A couple kissing passionately in bed
  example_title: Nsfw
- text: A woman naked
  example_title: Nsfw
- text: A man killing people
  example_title: Nsfw
- text: A mass shooting
  example_title: Nsfw
license: mit
language:
- en
metrics:
- f1
pipeline_tag: text-classification
tags:
- bert
- Transformers
- ' PyTorch'
---

# Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

This model is designed to categorize text into two classes: "Safe", or "Nsfw", which makes it suitable for content moderation and filtering applications.

The model was trained using a dataset containing 190,000 labeled text samples, distributed among the two classes of "Safe" and "Nsfw".

The model is based on the Distilbert-base model. 

In terms of performance, the model has achieved a score of 0.95 for F1 and 0.95 for accuracy. 
### Model Description

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.



- **Developed by:** Centrale Supélec Students
- **Model type:** 60M
- **Language(s) (NLP):** English
- **License:** MIT


### Training Procedure

The model was trained utilizing the Hugging Face Transformers library. The training approach employed transfer learning, where the original layers of the Distilbert-base model were frozen, and only the classification layers were fine-tuned on the labeled dataset. This selective fine-tuning allowed the model to leverage the pre-existing knowledge of the Distilbert-base model while adapting to the specific task at hand. To optimize memory usage and accelerate training, mixed precision fp16 was used. Further details regarding the training procedure can be found in the Technical Specifications section.

### Training Data

The training data for 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:

100,000 examples labeled as "Safe"

90,000 examples labeled as "Nsfw"

The data was preprocessed to remove stop words and punctuation, and to convert all text to lowercase.

More information about the training data can be found in the Dataset Card (availabe soon).

## Uses

The model can be integrated into larger systems for content moderation or filtering.



### Out-of-Scope Use

It should not be used for any illegal activities.

## Bias, Risks, and Limitations

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.

### Recommendations

<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->

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.



### Load model directly
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("eliasalbouzidi/distilbert-nsfw-text-classifier")

model = AutoModelForSequenceClassification.from_pretrained("eliasalbouzidi/distilbert-nsfw-text-classifier")
```
### Use a pipeline as a high-level helper
```python
from transformers import pipeline

pipe = pipeline("text-classification", model="eliasalbouzidi/distilbert-nsfw-text-classifier")
```


## Contact
Please reach out to eliasalbouzidi@gmail.com if you have any questions or feedback.