Downloads · 30 days
4
0% of all-time downloads
ahmettasdemir/distilbert-base-uncased-finetuned-emotion
distilbert-base-uncased-finetuned-emotion is a text classification model from ahmettasdemir. Use it when you need a label for a piece of text. It is set up for transformers.
This repository contains a notebook for fine-tuning the DistilBERT model on the emotion classification task. The trained model is available on the Hugging Face Model Hub.
Downloads · 30 days
4
0% of all-time downloads
All-time downloads
14.8K
Public
Repo size
536 MB
Likes
0
Public
Click a slice to open those files.
.bin268 MB · 100%
From the Hugging Face model README
This repository contains a notebook for fine-tuning the DistilBERT model on the emotion classification task. The trained model is available on the Hugging Face Model Hub.
Fine-Tuned Model Link: DistilBERT Base Uncased Fine-Tuned Emotion
The emotion classification task is performed on the emotions dataset, which contains textual data labeled with different emotions. The dataset is divided into three subsets:
The dataset is available through the Hugging Face Datasets library.
The notebook is divided into the following sections:
To use the fine-tuned DistilBERT model for emotion classification, follow these steps:
requirements.txt file.from transformers import TextClassificationPipeline, AutoModelForSequenceClassification, AutoTokenizer
# Load the fine-tuned model and tokenizer
model_name = "ahmettasdemir/distilbert-base-uncased-finetuned-emotion"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Create the text classification pipeline
pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
# Example text to classify
text = "I'm feeling happy today!"
# Perform text classification
result = pipeline(text)
# Print the predicted label
predicted_label = result[0]['label']
print("Predicted Emotion:", predicted_label)