Text Classification
Transformers
PyTorch
TensorBoard
Safetensors
distilbert
text-embeddings-inference
Instructions to use ayln/distilbert_finetuned_hatespeech with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ayln/distilbert_finetuned_hatespeech with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ayln/distilbert_finetuned_hatespeech")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ayln/distilbert_finetuned_hatespeech") model = AutoModelForSequenceClassification.from_pretrained("ayln/distilbert_finetuned_hatespeech", device_map="auto") - Notebooks
- Google Colab
- Kaggle
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Dataset Collection:
- The hatespeech dataset is collected from Kaggle, containing 25k Twits.
- The dataset has the three classes 0-Hatespeech 1-Offensive Language 2-Neither https://www.kaggle.com/datasets/mrmorj/hate-speech-and-offensive-language-dataset
Dataset Preparation:
- Change all text to lowercase
- Eliminate URLs
- Use TextBlob for spelling correction
- Convert emojis to text and keep sentiment
- Keep hashtags
- Eliminate @mentions
- Balancing
distilbert-base-uncased model fine-tuned for Hate Speech Detection
- The model is fine-tuned on the dataset, used PyTorch for tokenization
- This model can be used to create the labels for academic purposes or for industrial purposes.
- This model can be used for the inference purpose as well.
Data Fields: 24.783 Label: 0-Hatespeech 1-Offensive Language 2-Neither
Application:
- The model is useful for tweet hatespeech detection
- The model can be used to infer labels, classifying the tweet between the three classes
- You can fine-tune this model for your particular use cases
Model Implementation
- Best Hyperparameters: {'batch_size': 32, 'epochs': 7, 'learning_rate': 1e-05}
- Accuracy: 0.97
- Model Results:
- Accuracy: 0.84
- Precision: 0.83
- Recall: 0.84
- F1 Score: 0.83
- Steps to Implement Model:
- Downloads last month
- 6