Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- emotion-classification
|
| 5 |
+
- text-classification
|
| 6 |
+
- deberta
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# DeBERTa Emotion Classifier
|
| 11 |
+
|
| 12 |
+
This model classifies text into 5 emotions:
|
| 13 |
+
- 😠 Anger
|
| 14 |
+
- 😨 Fear
|
| 15 |
+
- 😊 Joy
|
| 16 |
+
- 😢 Sadness
|
| 17 |
+
- 😲 Surprise
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
```python
|
| 21 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 22 |
+
import torch
|
| 23 |
+
|
| 24 |
+
model_name = "Somya26/deberta-emotion-classifier"
|
| 25 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 26 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 27 |
+
|
| 28 |
+
text = "I am so happy today!"
|
| 29 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 30 |
+
outputs = model(**inputs)
|
| 31 |
+
probs = torch.sigmoid(outputs.logits).squeeze()
|
| 32 |
+
|
| 33 |
+
emotions = ['anger', 'fear', 'joy', 'sadness', 'surprise']
|
| 34 |
+
for emotion, prob in zip(emotions, probs):
|
| 35 |
+
print(f"{emotion}: {prob:.2%}")
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Training
|
| 39 |
+
|
| 40 |
+
Trained on emotion classification dataset using DeBERTa-v3-base.
|