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
|
Download README.md from Jayan12321/distilbert-emotion-classifier: direct link, hf CLI and curl.
- Browser
- Download file 1.9 kB
-
https://huggingface.co/Jayan12321/distilbert-emotion-classifier/resolve/main/README.md
- Command line
-
hf download hf://Jayan12321/distilbert-emotion-classifier/README.md
-
curl -L -o README.md https://huggingface.co/Jayan12321/distilbert-emotion-classifier/resolve/main/README.md
1.9 kB
| 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}] | |
| ``` | |