Jayan12321 commited on
Commit
accbd2d
Β·
verified Β·
1 Parent(s): bd1d08b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +60 -89
README.md CHANGED
@@ -1,89 +1,60 @@
1
- ---
2
- language: en
3
- license: apache-2.0
4
- tags:
5
- - text-classification
6
- - emotion
7
- - emotion-detection
8
- - affective-computing
9
- - distilbert
10
- - transformers
11
- - pytorch
12
- pipeline_tag: text-classification
13
- widget:
14
- - text: "I was skeptical at first, but the results completely blew me away with how good it turned out!"
15
- example_title: "Joy Example"
16
- - text: "I have been sitting here in complete darkness, feeling utterly exhausted and defeated."
17
- example_title: "Sadness Example"
18
- - text: "Get out of my face right now before I lose my temper completely!"
19
- example_title: "Anger Example"
20
- - text: "Every single moment spent with you makes my life feel infinitely more meaningful."
21
- example_title: "Love Example"
22
- ---
23
-
24
- # 🧠 DistilBERT Multiclass Emotion Classifier
25
-
26
- ## πŸ“Œ Model Description
27
- This model is a fine-tuned **DistilBERT (Distilled Bidirectional Encoder Representations from Transformers)** sequence classification model trained to detect nuanced affective and emotional states from unstructured text.
28
-
29
- The model classifies text into 6 core emotional categories:
30
- * **Joy** 🌟
31
- * **Sadness** 🌧️
32
- * **Anger** ⚑
33
- * **Fear** πŸ›‘οΈ
34
- * **Love** ❀️
35
- * **Surprise** 🎁
36
-
37
- ---
38
-
39
- ## πŸš€ Quick Start with Python & Hugging Face `transformers`
40
-
41
- You can use this model directly with the Hugging Face `pipeline`:
42
-
43
- ```python
44
- from transformers import pipeline
45
-
46
- # Initialize emotion pipeline
47
- classifier = pipeline("text-classification", model="Jayan12321/distilbert-emotion-classifier", top_k=None)
48
-
49
- # Run inference
50
- result = classifier("I was skeptical at first, but the results completely blew me away!")
51
- print(result)
52
- ```
53
-
54
- ---
55
-
56
- ## πŸ”¬ Benchmark Performance (Held-Out Test Set)
57
- * **Accuracy:** `92.50%`
58
- * **Macro F1-Score:** `0.8755`
59
- * **Weighted F1-Score:** `0.9248`
60
-
61
- | Emotion | Precision | Recall | F1-Score | Support |
62
- | :--- | :---: | :---: | :---: | :---: |
63
- | **Joy** | 0.95 | 0.94 | 0.95 | 695 |
64
- | **Sadness** | 0.96 | 0.97 | 0.96 | 581 |
65
- | **Anger** | 0.92 | 0.91 | 0.92 | 275 |
66
- | **Fear** | 0.88 | 0.92 | 0.90 | 224 |
67
- | **Love** | 0.79 | 0.87 | 0.83 | 159 |
68
- | **Surprise** | 0.93 | 0.56 | 0.70 | 66 |
69
-
70
- ---
71
-
72
- ## 🏭 Production Architecture Blueprint
73
- ```
74
- [ Free-Form Input Text ]
75
- β”‚
76
- β–Ό (<15ms SLA)
77
- [ Fast Tokenizer (WordPiece) ]
78
- β”‚
79
- β–Ό
80
- [ DistilBERT Sequence Classifier ]
81
- β”‚
82
- β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
83
- β–Ό β–Ό
84
- [ Argmax Class ] [ Softmax Distribution ]
85
- β€’ Primary Emotion β€’ Multi-class confidence
86
- ```
87
-
88
- ---
89
- *Authored and published by [Jayan Gupta](https://huggingface.co/Jayan12321) β€’ Data Scientist & AI Engineer*
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - text-classification
6
+ - emotion
7
+ - emotion-detection
8
+ - affective-computing
9
+ - distilbert
10
+ - transformers
11
+ - pytorch
12
+ pipeline_tag: text-classification
13
+ widget:
14
+ - text: "I was skeptical at first, but the results completely blew me away with how good it turned out!"
15
+ example_title: "Joy Example"
16
+ - text: "I have been sitting here in complete darkness, feeling utterly exhausted and defeated."
17
+ example_title: "Sadness Example"
18
+ - text: "Get out of my face right now before I lose my temper completely!"
19
+ example_title: "Anger Example"
20
+ - text: "Every single moment spent with you makes my life feel infinitely more meaningful."
21
+ example_title: "Love Example"
22
+ ---
23
+
24
+ # DistilBERT Multiclass Emotion Classifier 🎭
25
+
26
+ 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.
27
+
28
+ - **Author**: [Jayan Gupta](https://huggingface.co/Jayan12321)
29
+
30
+ ---
31
+
32
+ ## 🎯 Model Overview & Classes
33
+ The model classifies text across 6 primary emotional dimensions:
34
+ * `0`: **Sadness** (grief, sorrow, exhaustion)
35
+ * `1`: **Joy** (happiness, triumph, gratitude)
36
+ * `2`: **Love** (affection, admiration, intimacy)
37
+ * `3`: **Anger** (irritation, frustration, rage)
38
+ * `4`: **Fear** (anxiety, dread, panic)
39
+ * `5`: **Surprise** (shock, amazement, disbelief)
40
+
41
+ ---
42
+
43
+ ## πŸ’» Python Quickstart with Transformers Pipeline
44
+
45
+ ```python
46
+ from transformers import pipeline
47
+
48
+ # Load fine-tuned pipeline directly from Hugging Face
49
+ classifier = pipeline(
50
+ "text-classification",
51
+ model="Jayan12321/distilbert-emotion-classifier"
52
+ )
53
+
54
+ # Run inference
55
+ sample_text = "I received the scholarship offer this morning and I cannot stop smiling!"
56
+ prediction = classifier(sample_text)
57
+
58
+ print(prediction)
59
+ # Output: [{'label': 'joy', 'score': 0.987}]
60
+ ```