hrshlgunjal commited on
Commit
793118f
·
verified ·
1 Parent(s): 1edb4c6

Add model card

Browse files
Files changed (1) hide show
  1. README.md +92 -0
README.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - text-classification
6
+ - multi-label-classification
7
+ - emotion-classification
8
+ - deberta-v3
9
+ - pytorch
10
+ ---
11
+
12
+ # Emotion Classification Model
13
+
14
+ This model classifies text into 5 emotion categories: **anger**, **fear**, **joy**, **sadness**, and **surprise**.
15
+
16
+ ## Model Description
17
+
18
+ - **Base Model:** roberta-base
19
+ - **Task:** Multi-label text classification
20
+ - **Labels:** anger, fear, joy, sadness, surprise
21
+ - **Training Strategy:** 5-Fold Cross-Validation
22
+ - **Framework:** PyTorch + Transformers
23
+
24
+ ## Performance
25
+
26
+ ### Overall Metrics
27
+ - **Macro F1:** N/A
28
+ - **Cross-Validation:** 0.7684 +/- 0.0099
29
+
30
+ ### Per-Label Performance
31
+ N/A
32
+
33
+ ### Optimized Thresholds
34
+ N/A
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
40
+ import torch
41
+ import numpy as np
42
+
43
+ # Load model and tokenizer
44
+ model = AutoModelForSequenceClassification.from_pretrained("hrshlgunjal/emotion-classifier-roberta-base")
45
+ tokenizer = AutoTokenizer.from_pretrained("hrshlgunjal/emotion-classifier-roberta-base")
46
+
47
+ # Optimized thresholds (use these for best results)
48
+ thresholds = np.array([0.5, 0.5, 0.5, 0.5, 0.5])
49
+ labels = ['anger', 'fear', 'joy', 'sadness', 'surprise']
50
+
51
+ # Predict emotions
52
+ def predict_emotions(text):
53
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
54
+ with torch.no_grad():
55
+ outputs = model(**inputs)
56
+ probs = torch.sigmoid(outputs.logits).cpu().numpy()[0]
57
+ predictions = (probs >= thresholds).astype(int)
58
+ return {label: (pred, prob) for label, pred, prob in zip(labels, predictions, probs)}
59
+
60
+ # Example
61
+ text = "I am so excited about this amazing opportunity!"
62
+ result = predict_emotions(text)
63
+ print(result)
64
+ ```
65
+
66
+ ## Training Details
67
+
68
+ - **Optimizer:** AdamW with differential weight decay
69
+ - **Learning Rate:** 2e-05
70
+ - **Batch Size:** 32
71
+ - **Epochs:** 3
72
+ - **Max Sequence Length:** 128
73
+ - **Warmup Ratio:** 0.1
74
+ - **Weight Decay:** 0.01
75
+ - **Mixed Precision:** Enabled (FP16)
76
+ - **Gradient Clipping:** 1.0
77
+
78
+ ## Training Infrastructure
79
+
80
+ - **Device:** GPU
81
+ - **Training Time:** ~225 minutes (approximate)
82
+ - **Framework Versions:**
83
+ - PyTorch: 2.6.0+cu124
84
+ - Transformers: 4.53.3
85
+
86
+ ## Model Card Authors
87
+
88
+ hrshlgunjal
89
+
90
+ ## Model Card Contact
91
+
92
+ For questions or feedback, please open an issue in the model repository.