Text Classification
Transformers
PyTorch
English
distilbert
fill-mask
emotion
emotion-detection
affective-computing
text-embeddings-inference
Instructions to use Jayan12321/distilbert-emotion-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jayan12321/distilbert-emotion-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Jayan12321/distilbert-emotion-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("Jayan12321/distilbert-emotion-classifier") model = AutoModelForMaskedLM.from_pretrained("Jayan12321/distilbert-emotion-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,896 Bytes
accbd2d | 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 | ---
language: en
license: apache-2.0
tags:
- text-classification
- emotion
- emotion-detection
- affective-computing
- distilbert
- transformers
- pytorch
pipeline_tag: text-classification
widget:
- text: "I was skeptical at first, but the results completely blew me away with how good it turned out!"
example_title: "Joy Example"
- text: "I have been sitting here in complete darkness, feeling utterly exhausted and defeated."
example_title: "Sadness Example"
- text: "Get out of my face right now before I lose my temper completely!"
example_title: "Anger Example"
- text: "Every single moment spent with you makes my life feel infinitely more meaningful."
example_title: "Love Example"
---
# DistilBERT Multiclass Emotion Classifier 🎭
A fine-tuned **DistilBERT (Distilled Bidirectional Encoder Representations from Transformers)** sequence classification model trained to detect nuanced affective and emotional states from unstructured natural language.
- **Author**: [Jayan Gupta](https://huggingface.co/Jayan12321)
---
## 🎯 Model Overview & Classes
The model classifies text across 6 primary emotional dimensions:
* `0`: **Sadness** (grief, sorrow, exhaustion)
* `1`: **Joy** (happiness, triumph, gratitude)
* `2`: **Love** (affection, admiration, intimacy)
* `3`: **Anger** (irritation, frustration, rage)
* `4`: **Fear** (anxiety, dread, panic)
* `5`: **Surprise** (shock, amazement, disbelief)
---
## 💻 Python Quickstart with Transformers Pipeline
```python
from transformers import pipeline
# Load fine-tuned pipeline directly from Hugging Face
classifier = pipeline(
"text-classification",
model="Jayan12321/distilbert-emotion-classifier"
)
# Run inference
sample_text = "I received the scholarship offer this morning and I cannot stop smiling!"
prediction = classifier(sample_text)
print(prediction)
# Output: [{'label': 'joy', 'score': 0.987}]
```
|