eliasalbouzidi's picture
Update README.md
720e0a3 verified
|
raw
history blame
4.1 kB
metadata
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

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: 80M
  • 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

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

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

from transformers import pipeline

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

Contact

Please reach out to [email protected] if you have any questions or feedback.