Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,95 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- dair-ai/emotion
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
library_name: transformers
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# π Emotion-X: Fine-tuned DeBERTa-Xlarge Based Emotion Detection π
|
| 11 |
+
|
| 12 |
+
This is a fine-tuned version of [microsoft/deberta-xlarge-mnli](https://huggingface.co/microsoft/deberta-xlarge-mnli) for emotion detection on the [dair-ai/emotion](https://huggingface.co/dair-ai/emotion) dataset.
|
| 13 |
+
|
| 14 |
+
## π Model Details
|
| 15 |
+
|
| 16 |
+
- **π Model Name:** `your-repo/deberta-xlarge-emotion`
|
| 17 |
+
- **π Base Model:** `microsoft/deberta-xlarge-mnli`
|
| 18 |
+
- **π Dataset:** [dair-ai/emotion](https://huggingface.co/dair-ai/emotion)
|
| 19 |
+
- **βοΈ Fine-tuning:** This model was fine-tuned for emotion detection with a classification head for six emotional categories (anger, disgust, fear, joy, sadness, surprise).
|
| 20 |
+
|
| 21 |
+
## ποΈ Training
|
| 22 |
+
|
| 23 |
+
The model was trained using the following parameters:
|
| 24 |
+
|
| 25 |
+
- **π§ Learning Rate:** 2e-5
|
| 26 |
+
- **π¦ Batch Size:** 4
|
| 27 |
+
- **β³ Epochs:** 3
|
| 28 |
+
- **βοΈ Weight Decay:** 0.01
|
| 29 |
+
- **π
Evaluation Strategy:** Epoch
|
| 30 |
+
|
| 31 |
+
### ποΈ Training Details
|
| 32 |
+
|
| 33 |
+
- **π Eval Loss:** 0.0858
|
| 34 |
+
- **β±οΈ Eval Runtime:** 110070.6349 seconds
|
| 35 |
+
- **π Eval Samples/Second:** 78.495
|
| 36 |
+
- **π Eval Steps/Second:** 2.453
|
| 37 |
+
- **π Epoch:** 3.0
|
| 38 |
+
- **π Train Loss:** 0.1049
|
| 39 |
+
- **β³ Eval Accuracy:** 94.6%
|
| 40 |
+
- **π Eval Precision:** 94.8%
|
| 41 |
+
- **β±οΈ Eval Recall:** 94.5%
|
| 42 |
+
- **π Eval F1 Score:** 94.7%
|
| 43 |
+
|
| 44 |
+
## π Usage
|
| 45 |
+
|
| 46 |
+
You can use this model directly with the Hugging Face `transformers` library:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 50 |
+
|
| 51 |
+
model_name = "your-repo/deberta-xlarge-emotion"
|
| 52 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 53 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 54 |
+
|
| 55 |
+
# Example usage
|
| 56 |
+
def predict_emotion(text):
|
| 57 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
|
| 58 |
+
outputs = model(**inputs)
|
| 59 |
+
logits = outputs.logits
|
| 60 |
+
predictions = logits.argmax(dim=1)
|
| 61 |
+
return predictions
|
| 62 |
+
|
| 63 |
+
text = "I'm so happy with the results!"
|
| 64 |
+
emotion = predict_emotion(text)
|
| 65 |
+
print("Detected Emotion:", emotion)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## π Emotion Labels
|
| 69 |
+
- π Anger
|
| 70 |
+
- π€’ Disgust
|
| 71 |
+
- π¨ Fear
|
| 72 |
+
- π Joy
|
| 73 |
+
- π’ Sadness
|
| 74 |
+
- π² Surprise
|
| 75 |
+
|
| 76 |
+
## π License
|
| 77 |
+
|
| 78 |
+
This model is licensed under the [MIT License](LICENSE).
|
| 79 |
+
|
| 80 |
+
## π Model Card Data
|
| 81 |
+
|
| 82 |
+
| Parameter | Value |
|
| 83 |
+
|-------------------------------|---------------------------|
|
| 84 |
+
| Model Name | microsoft/deberta-xlarge-mnli |
|
| 85 |
+
| Training Dataset | dair-ai/emotion |
|
| 86 |
+
| Number of Training Epochs | 3 |
|
| 87 |
+
| Learning Rate | 2e-5 |
|
| 88 |
+
| Per Device Train Batch Size | 4 |
|
| 89 |
+
| Evaluation Strategy | Epoch |
|
| 90 |
+
| Best Model Accuracy | 94.6% |
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
## Download
|
| 94 |
+
|
| 95 |
+
Emotion-X is available for download from [Hugging Face Model Hub](https://huggingface.co/AnkitAI/deberta-xlarge-base-emotions-classifier).
|