Update README.md
Browse files
README.md
CHANGED
|
@@ -5,7 +5,6 @@ datasets:
|
|
| 5 |
- IconicAI/DDD
|
| 6 |
language:
|
| 7 |
- en
|
| 8 |
-
- ko
|
| 9 |
metrics:
|
| 10 |
- accuracy
|
| 11 |
- f1
|
|
@@ -13,18 +12,35 @@ base_model:
|
|
| 13 |
- Mango-Juice/trpg_mlm
|
| 14 |
- microsoft/deberta-v3-large
|
| 15 |
library_name: transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
---
|
|
|
|
| 17 |
# GoEmotions Fine-tuned Model
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
##
|
| 22 |
- **Base Model**: Mango-Juice/trpg_mlm
|
| 23 |
- **Task**: Multi-label Emotion Classification
|
| 24 |
-
- **Labels**: 28
|
| 25 |
-
- **Training**:
|
| 26 |
|
| 27 |
-
##
|
| 28 |
- admiration
|
| 29 |
- amusement
|
| 30 |
- anger
|
|
@@ -54,17 +70,17 @@ library_name: transformers
|
|
| 54 |
- surprise
|
| 55 |
- neutral
|
| 56 |
|
| 57 |
-
##
|
| 58 |
|
| 59 |
```python
|
| 60 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 61 |
import torch
|
| 62 |
|
| 63 |
-
#
|
| 64 |
tokenizer = AutoTokenizer.from_pretrained("Mango-Juice/trpg_emotion_classification")
|
| 65 |
model = AutoModelForSequenceClassification.from_pretrained("Mango-Juice/trpg_emotion_classification")
|
| 66 |
|
| 67 |
-
#
|
| 68 |
def predict_emotions(text):
|
| 69 |
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
|
| 70 |
with torch.no_grad():
|
|
@@ -74,18 +90,18 @@ def predict_emotions(text):
|
|
| 74 |
emotion_labels = ['admiration', 'amusement', 'anger', 'annoyance', 'approval', 'caring', 'confusion', 'curiosity', 'desire', 'disappointment', 'disapproval', 'disgust', 'embarrassment', 'excitement', 'fear', 'gratitude', 'grief', 'joy', 'love', 'nervousness', 'optimism', 'pride', 'realization', 'relief', 'remorse', 'sadness', 'surprise', 'neutral']
|
| 75 |
return {emotion: float(prob) for emotion, prob in zip(emotion_labels, probs)}
|
| 76 |
|
| 77 |
-
#
|
| 78 |
text = "I am so happy today!"
|
| 79 |
emotions = predict_emotions(text)
|
| 80 |
print(emotions)
|
| 81 |
```
|
| 82 |
|
| 83 |
-
##
|
| 84 |
-
-
|
| 85 |
-
-
|
| 86 |
|
| 87 |
-
##
|
| 88 |
-
-
|
| 89 |
-
-
|
| 90 |
-
-
|
| 91 |
-
-
|
|
|
|
| 5 |
- IconicAI/DDD
|
| 6 |
language:
|
| 7 |
- en
|
|
|
|
| 8 |
metrics:
|
| 9 |
- accuracy
|
| 10 |
- f1
|
|
|
|
| 12 |
- Mango-Juice/trpg_mlm
|
| 13 |
- microsoft/deberta-v3-large
|
| 14 |
library_name: transformers
|
| 15 |
+
model-index:
|
| 16 |
+
- name: trpg_emotion_classification
|
| 17 |
+
results:
|
| 18 |
+
- task:
|
| 19 |
+
type: text-classification
|
| 20 |
+
dataset:
|
| 21 |
+
name: IconicAI/DDD (custom subset manually labeled)
|
| 22 |
+
type: custom
|
| 23 |
+
split: test
|
| 24 |
+
config: csv
|
| 25 |
+
metrics:
|
| 26 |
+
- type: accuracy
|
| 27 |
+
value: 0.929
|
| 28 |
+
- type: f1
|
| 29 |
+
value: 0.476
|
| 30 |
+
name: f1 macro
|
| 31 |
---
|
| 32 |
+
|
| 33 |
# GoEmotions Fine-tuned Model
|
| 34 |
|
| 35 |
+
This is a multi-label emotion classification model trained on the GoEmotions dataset and TRPG sentences.
|
| 36 |
|
| 37 |
+
## Model Information
|
| 38 |
- **Base Model**: Mango-Juice/trpg_mlm
|
| 39 |
- **Task**: Multi-label Emotion Classification
|
| 40 |
+
- **Labels**: 28 emotion labels
|
| 41 |
+
- **Training**: Completed a two-stage fine-tuning process (1st stage: GoEmotions data, 2nd stage: TRPG sentence data)
|
| 42 |
|
| 43 |
+
## Emotion Labels
|
| 44 |
- admiration
|
| 45 |
- amusement
|
| 46 |
- anger
|
|
|
|
| 70 |
- surprise
|
| 71 |
- neutral
|
| 72 |
|
| 73 |
+
## Usage
|
| 74 |
|
| 75 |
```python
|
| 76 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 77 |
import torch
|
| 78 |
|
| 79 |
+
# Load model and tokenizer
|
| 80 |
tokenizer = AutoTokenizer.from_pretrained("Mango-Juice/trpg_emotion_classification")
|
| 81 |
model = AutoModelForSequenceClassification.from_pretrained("Mango-Juice/trpg_emotion_classification")
|
| 82 |
|
| 83 |
+
# Inference
|
| 84 |
def predict_emotions(text):
|
| 85 |
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
|
| 86 |
with torch.no_grad():
|
|
|
|
| 90 |
emotion_labels = ['admiration', 'amusement', 'anger', 'annoyance', 'approval', 'caring', 'confusion', 'curiosity', 'desire', 'disappointment', 'disapproval', 'disgust', 'embarrassment', 'excitement', 'fear', 'gratitude', 'grief', 'joy', 'love', 'nervousness', 'optimism', 'pride', 'realization', 'relief', 'remorse', 'sadness', 'surprise', 'neutral']
|
| 91 |
return {emotion: float(prob) for emotion, prob in zip(emotion_labels, probs)}
|
| 92 |
|
| 93 |
+
# Example
|
| 94 |
text = "I am so happy today!"
|
| 95 |
emotions = predict_emotions(text)
|
| 96 |
print(emotions)
|
| 97 |
```
|
| 98 |
|
| 99 |
+
## Performance
|
| 100 |
+
- The fine-tuned model provides improved performance in emotion classification.
|
| 101 |
+
- Data augmentation was applied for minority classes.
|
| 102 |
|
| 103 |
+
## Training Details
|
| 104 |
+
- **Data Augmentation**: Oversampling based on paraphrasing and back-translation.
|
| 105 |
+
- **Loss Function**: Focal Loss with Label Smoothing
|
| 106 |
+
- **Optimizer**: AdamW
|
| 107 |
+
- **Scheduler**: ReduceLROnPlateau
|