Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,75 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- emotion-recognition
|
| 4 |
+
- affective-computing
|
| 5 |
+
- text-classification
|
| 6 |
+
- huggingface
|
| 7 |
+
license: mit
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# MiniLM-L12-Affect: Emotion Classification Model
|
| 12 |
+
|
| 13 |
+
This model is a fine-tuned version of **MiniLM-L12-H384-uncased** for **emotion classification** in text. It is capable of predicting six basic emotions: **Joy, Anger, Fear, Sadness, Surprise, Disgust**.
|
| 14 |
+
|
| 15 |
+
## Description
|
| 16 |
+
|
| 17 |
+
This model has been fine-tuned on a custom emotion dataset. It takes a text input and predicts the intensity of each of the six emotions listed above. The model uses the **MiniLM** architecture, which is lightweight and fast, offering good performance for NLP tasks with fewer parameters.
|
| 18 |
+
|
| 19 |
+
## Predictable Emotions
|
| 20 |
+
|
| 21 |
+
The model can predict the following emotions in text:
|
| 22 |
+
|
| 23 |
+
- **Joy**
|
| 24 |
+
- **Anger**
|
| 25 |
+
- **Fear**
|
| 26 |
+
- **Sadness**
|
| 27 |
+
- **Surprise**
|
| 28 |
+
- **Disgust**
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
Here is an example of how to run inference with the model:
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 36 |
+
import torch
|
| 37 |
+
|
| 38 |
+
# Load the model and tokenizer
|
| 39 |
+
model = AutoModelForSequenceClassification.from_pretrained("pharci/MiniLM-L12-Affect")
|
| 40 |
+
tokenizer = AutoTokenizer.from_pretrained("pharci/MiniLM-L12-Affect")
|
| 41 |
+
|
| 42 |
+
# Emotion prediction function
|
| 43 |
+
def predict_emotions(text):
|
| 44 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
|
| 45 |
+
with torch.no_grad():
|
| 46 |
+
outputs = model(**inputs)
|
| 47 |
+
predictions = outputs.logits.squeeze().cpu().numpy()
|
| 48 |
+
return predictions
|
| 49 |
+
|
| 50 |
+
# Example prediction
|
| 51 |
+
test_text = "I am really happy today!"
|
| 52 |
+
predictions = predict_emotions(test_text)
|
| 53 |
+
print(predictions)
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Deployment
|
| 57 |
+
|
| 58 |
+
The model is ready to be deployed in applications that require emotion detection, such as chatbots, recommendation systems, or other services needing emotion analysis in text.
|
| 59 |
+
|
| 60 |
+
## License
|
| 61 |
+
|
| 62 |
+
The model is licensed under the **MIT License**. You are free to use, modify, and integrate it into your own projects.
|
| 63 |
+
|
| 64 |
+
## Limitations
|
| 65 |
+
|
| 66 |
+
- This model was trained on a specific custom dataset and might not perform optimally on other domains or languages.
|
| 67 |
+
- The model currently only handles French text. Fine-tuning for other languages may be necessary.
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
### Credits
|
| 72 |
+
|
| 73 |
+
- Base model: **MiniLM-L12-H384-uncased** (Microsoft)
|
| 74 |
+
- Dataset: **Custom Dataset**
|
| 75 |
+
- Developed by: **[Your name or your team]**
|