Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- english
|
| 6 |
+
- emotion-classification
|
| 7 |
+
- text-classification
|
| 8 |
+
- fine-tuned
|
| 9 |
+
- roberta
|
| 10 |
+
base_model: j-hartmann/emotion-english-distilroberta-base
|
| 11 |
+
pipeline_tag: text-classification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# English Text Emotion Recognition Model
|
| 15 |
+
|
| 16 |
+
Fine-tuned RoBERTa-style model for **multi-class emotion classification in English text**.
|
| 17 |
+
|
| 18 |
+
This model was trained for 6 epochs on an English emotion dataset and achieves modest validation performance (~90% accuracy).
|
| 19 |
+
It is suitable as a starting point for English emotion detection tasks, but would benefit from longer training, more data, or a better-suited base model.
|
| 20 |
+
|
| 21 |
+
## Model Details
|
| 22 |
+
|
| 23 |
+
### Model Description
|
| 24 |
+
|
| 25 |
+
- **Developed by:** Bimsara Serasinghe
|
| 26 |
+
- **Shared by:** Bimsara Serasinghe
|
| 27 |
+
- **Model type:** Text Classification (fine-tuned transformer for multi-class emotion detection)
|
| 28 |
+
- **Language(s) (NLP):** English
|
| 29 |
+
- **License:** Apache-2.0
|
| 30 |
+
- **Finetuned from model:** j-hartmann/emotion-english-distilroberta-base
|
| 31 |
+
### Model Sources
|
| 32 |
+
|
| 33 |
+
- **Repository:** https://huggingface.co/ShanukaB/English_Text_Emotion_Recogniton_Model
|
| 34 |
+
|
| 35 |
+
## Uses
|
| 36 |
+
|
| 37 |
+
### Direct Use
|
| 38 |
+
|
| 39 |
+
Use the model directly with Hugging Face `pipeline` to classify English sentences into emotion categories.
|
| 40 |
+
|
| 41 |
+
### Downstream Use
|
| 42 |
+
|
| 43 |
+
- Building emotion-aware English chatbots
|
| 44 |
+
- Social media emotion/sentiment monitoring (Twitter/X, Reddit, comments)
|
| 45 |
+
- Mental health & wellbeing tools with emotion detection
|
| 46 |
+
- Customer support & feedback analysis
|
| 47 |
+
- Academic/research experiments in English affective computing
|
| 48 |
+
|
| 49 |
+
### Out-of-Scope Use
|
| 50 |
+
|
| 51 |
+
- High-stakes automated decisions (mental health diagnosis, hiring, legal)
|
| 52 |
+
- Safety-critical real-time systems without thorough validation
|
| 53 |
+
- Non-English languages (poor generalization expected)
|
| 54 |
+
|
| 55 |
+
### Recommendations
|
| 56 |
+
|
| 57 |
+
- Use model outputs only as a signal — combine with human judgment in sensitive contexts
|
| 58 |
+
- Fine-tune further (more epochs, larger/cleaner dataset, or emotion-specialized base like roberta-base-go_emotions)
|
| 59 |
+
- Evaluate on your specific use-case domain before production
|
| 60 |
+
|
| 61 |
+
## How to Get Started with the Model
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
from transformers import pipeline
|
| 65 |
+
import joblib
|
| 66 |
+
|
| 67 |
+
# Load the fine-tuned model
|
| 68 |
+
classifier = pipeline(
|
| 69 |
+
"text-classification",
|
| 70 |
+
model="YOUR_USERNAME/YOUR_MODEL_NAME",
|
| 71 |
+
tokenizer="YOUR_USERNAME/YOUR_MODEL_NAME"
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# Optional: load saved label encoder (if uploaded to repo)
|
| 75 |
+
# label_encoder = joblib.load("label_encoder.pkl")
|
| 76 |
+
|
| 77 |
+
texts = [
|
| 78 |
+
"I'm so happy today! 🎉",
|
| 79 |
+
"This is really making me angry...",
|
| 80 |
+
"I feel so scared right now 😨",
|
| 81 |
+
"This is disgusting, I can't believe it."
|
| 82 |
+
]
|
| 83 |
+
|
| 84 |
+
for text in texts:
|
| 85 |
+
result = classifier(text)[0]
|
| 86 |
+
# If labels are saved as "LABEL_0", "LABEL_1", etc.
|
| 87 |
+
# num_label = int(result["label"].split("_")[-1])
|
| 88 |
+
# emotion = label_encoder.inverse_transform([num_label])[0] if label_encoder else result["label"]
|
| 89 |
+
print(f"Text: {text}")
|
| 90 |
+
print(f"→ {result['label']} (confidence: {result['score']:.3f})\n")
|