Downloads · 30 days
9
22% of all-time downloads
SagarVidya/distilbert-emotion-model_v4
distilbert-emotion-model_v4 is a text classification model from SagarVidya. Use it when you need a label for a piece of text. It is set up for transformers.
This model is fine-tuned on the DistilBERT base model (distilbert-base-uncased) to classify text into five distinct emotions. It is trained on the Emotion Dataset using the Hugging Face Trainer API, leveraging the pow…
Downloads · 30 days
9
22% of all-time downloads
All-time downloads
41
Public
Parameters
67M
268 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
This model is fine-tuned on the DistilBERT base model (distilbert-base-uncased) to classify text into five distinct emotions. It is trained on the Emotion Dataset using the Hugging Face Trainer API, leveraging the powerful DistilBERT architecture.
The five emotion classes predicted by the model are as follows:
-> Label 0 - Happiness
-> Label 1 - Love
-> Label 2 - Neutral
-> Label 3 - Sadness
-> Label 4 - Worry
DistilBERT, a smaller and faster version of the BERT architecture, was used for this model due to its computational efficiency and performance. DistilBERT is pretrained using a teacher-student training approach where the BERT base model acts as the teacher, allowing DistilBERT to retain much of BERT's accuracy while being lighter and faster.
This fine-tuned model is ideal for applications requiring emotion detection in textual data, such as:
Sentiment analysis Social media monitoring Chatbots and virtual assistants Customer feedback analysis The model is trained using transfer learning to adapt the general language understanding capabilities of DistilBERT to the specific task of multi-class emotion classification.
The model can be used for analyzing the emotional tone of conversations, tweets, or other textual data. It is suitable for production use in systems where inference speed and lightweight architecture are crucial. Feel free to modify further based on any additional details you'd like to emphasize!
Use the code below to get started with the model.
#importing pipeline
from transformers import pipeline
#initializing my model
model = pipeline(task="sentiment-analysis",
model="SagarVidya/distilbert-emotion-model_v4")
#prediction - Prompt 1
prediction1 = model("You are the light of my life; every moment with you feels magical.")
print("Sentiment of the 1st prompt: " + str(prediction1))
#prediction - Prompt 2
prediction2 = model("""
After years of building a life together, I never thought I’d have to say goodbye to you.
The house feels so empty now, the silence heavier than I ever imagined.
Every corner holds a memory of us, and yet, you're not here to share it.
How do I move forward when my heart is still clinging to the past we promised we’d never leave behind?
""")
print("Sentiment of the 2nd prompt: " + str(prediction2))
RESULT
Sentiment of the 1st prompt: [{'label': 'LABEL_1', 'score': 0.8571325540542603}] ##Love
Sentiment of the 2nd prompt: [{'label': 'LABEL_3', 'score': 0.974511981010437}] ##Sadness
Vidya Sagar (Fine-tuning and Documentation)