Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
π XLM-R Multi-Emotion Classifier π
|
| 2 |
+
|
| 3 |
+
π Mission Statement
|
| 4 |
+
|
| 5 |
+
The XLM-R Multi-Emotion Classifier is built to understand human emotions across multiple languages, helping researchers, developers, and businesses analyze sentiment in text at scale.
|
| 6 |
+
|
| 7 |
+
From social media monitoring to mental health insights, this model is designed to decode emotions with accuracy and fairness.
|
| 8 |
+
|
| 9 |
+
π― Vision
|
| 10 |
+
|
| 11 |
+
Our goal is to create an AI-powered emotion recognition model that:
|
| 12 |
+
β’ π Understands emotions across cultures and languages
|
| 13 |
+
β’ π€ Bridges the gap between AI and human psychology
|
| 14 |
+
β’ π‘ Empowers businesses, researchers, and developers to extract valuable insights from text
|
| 15 |
+
|
| 16 |
+
π Model Overview
|
| 17 |
+
|
| 18 |
+
Model Name: msgfrom96/xlm_emo_multi
|
| 19 |
+
Architecture: XLM-RoBERTa (Multi-Lingual Transformer)
|
| 20 |
+
Task: Multi-label Emotion Classification
|
| 21 |
+
Languages: English, Arabic
|
| 22 |
+
Dataset: SemEval-2018 Task 1: Affect in Tweets
|
| 23 |
+
|
| 24 |
+
The model predicts multiple emotions per text using multi-label classification. It can recognize emotions like:
|
| 25 |
+
β’ π Anger, Anticipation, Disgust, Fear, Joy, Sadness, Surprise, Trust, Love, Optimism, Pessimism
|
| 26 |
+
|
| 27 |
+
π¦ How to Use
|
| 28 |
+
|
| 29 |
+
Load Model and Tokenizer
|
| 30 |
+
|
| 31 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 32 |
+
|
| 33 |
+
model_name = "msgfrom96/xlm_emo_multi"
|
| 34 |
+
|
| 35 |
+
# Load model and tokenizer
|
| 36 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 38 |
+
|
| 39 |
+
# Example text
|
| 40 |
+
text = "I can't believe how amazing this is! So happy and excited!"
|
| 41 |
+
|
| 42 |
+
# Tokenize input
|
| 43 |
+
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
|
| 44 |
+
|
| 45 |
+
# Get model predictions
|
| 46 |
+
outputs = model(**inputs)
|
| 47 |
+
print(outputs.logits) # Raw emotion scores
|
| 48 |
+
|
| 49 |
+
Interpreting Results
|
| 50 |
+
|
| 51 |
+
The model outputs logits (raw scores) for each emotion. Apply a sigmoid activation to convert these into probabilities:
|
| 52 |
+
|
| 53 |
+
import torch
|
| 54 |
+
|
| 55 |
+
probs = torch.sigmoid(outputs.logits)
|
| 56 |
+
print(probs)
|
| 57 |
+
|
| 58 |
+
Each score represents the probability of an emotion being present in the text.
|
| 59 |
+
|
| 60 |
+
β‘ Training & Fine-Tuning Details
|
| 61 |
+
β’ Base Model: XLM-RoBERTa (xlm-roberta-base) π
|
| 62 |
+
β’ Dataset: SemEval-2018 (English & Arabic Tweets) π
|
| 63 |
+
β’ Training Strategy: Multi-label classification π₯
|
| 64 |
+
β’ Optimizer: AdamW βοΈ
|
| 65 |
+
β’ Batch Size: 16 ποΈββοΈ
|
| 66 |
+
β’ Learning Rate: 2e-5 π―
|
| 67 |
+
β’ Hardware: Trained on AWS SageMaker with CUDA GPU support π
|
| 68 |
+
β’ Evaluation Metric: Macro-F1 & Micro-F1 π
|
| 69 |
+
β’ Best Model Selection: Auto-selected via load_best_model_at_end=True β
|
| 70 |
+
|
| 71 |
+
π Citations & References
|
| 72 |
+
|
| 73 |
+
If you use this model, please cite the following sources:
|
| 74 |
+
|
| 75 |
+
π SemEval-2018 Dataset
|
| 76 |
+
Mohammad, S., Bravo-Marquez, F., Salameh, M., & Kiritchenko, S. (2018). βSemEval-2018 Task 1: Affect in Tweets.β Proceedings of SemEval-2018.
|
| 77 |
+
π Paper Link
|
| 78 |
+
|
| 79 |
+
π XLM-RoBERTa
|
| 80 |
+
Conneau, A., Khandelwal, K., Goyal, N., Chaudhary, V., Wenzek, G., GuzmΓ‘n, F., Grave, E., Ott, M., Zettlemoyer, L., & Stoyanov, V. (2020). βUnsupervised Cross-lingual Representation Learning at Scale.β Proceedings of ACL 2020.
|
| 81 |
+
π Paper Link
|
| 82 |
+
|
| 83 |
+
π Transformers Library
|
| 84 |
+
Hugging Face (2020). βπ€ Transformers: State-of-the-art Natural Language Processing for Pytorch and TensorFlow 2.0.β
|
| 85 |
+
π Library Docs
|
| 86 |
+
|
| 87 |
+
π€ Contributing
|
| 88 |
+
|
| 89 |
+
Want to improve the model? Feel free to:
|
| 90 |
+
β’ Train it on more languages π
|
| 91 |
+
β’ Optimize for low-resource devices π₯
|
| 92 |
+
β’ Integrate it into real-world applications π‘
|
| 93 |
+
β’ Submit pull requests or discussions π
|
| 94 |
+
|
| 95 |
+
π Acknowledgments
|
| 96 |
+
|
| 97 |
+
Special thanks to the Hugging Face team, SemEval organizers, and the NLP research community for providing the tools and datasets that made this model possible. π
|
| 98 |
+
|
| 99 |
+
π Connect & Feedback
|
| 100 |
+
|
| 101 |
+
π¬ Questions? Issues? Create a discussion on the Hugging Face Model Hub
|
| 102 |
+
π§ Email: gleiser2@hotmail.com
|
| 103 |
+
|
| 104 |
+
---
|
| 105 |
+
license: mit
|
| 106 |
+
---
|