Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,305 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
###
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
### Direct Use
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
### Out-of-Scope Use
|
| 53 |
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
## How to Get Started with the Model
|
| 71 |
|
| 72 |
-
Use the code below to get started with the model
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
|
|
|
| 81 |
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
-
|
|
|
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
-
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
-
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
####
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
[
|
|
|
|
|
|
|
| 120 |
|
| 121 |
#### Metrics
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
### Results
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
[
|
| 140 |
|
| 141 |
## Environmental Impact
|
| 142 |
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
|
| 147 |
-
- **Hardware Type:** [
|
| 148 |
-
- **Hours used:** [
|
| 149 |
-
- **Cloud Provider:** [
|
| 150 |
-
- **Compute Region:** [
|
| 151 |
-
- **Carbon Emitted:** [
|
| 152 |
|
| 153 |
-
## Technical Specifications
|
| 154 |
|
| 155 |
-
### Model Architecture
|
| 156 |
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
### Compute Infrastructure
|
| 160 |
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
#### Hardware
|
| 164 |
|
| 165 |
-
[
|
| 166 |
|
| 167 |
#### Software
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
## Citation
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
**BibTeX:**
|
| 176 |
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
**APA:**
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
|
| 189 |
-
##
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
## Model Card
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
[
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- text-classification
|
| 5 |
+
- emotion-detection
|
| 6 |
+
- sentiment-analysis
|
| 7 |
+
- distilbert
|
| 8 |
+
language:
|
| 9 |
+
- en
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
base_model: distilbert-base-uncased
|
| 12 |
+
pipeline_tag: text-classification
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
- f1
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# DistilBERT Emotion Classifier
|
| 19 |
|
| 20 |
+
## Model Description
|
| 21 |
|
| 22 |
+
This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) for multi-class emotion classification. The model classifies text into different emotional categories, enabling applications in sentiment analysis, customer feedback analysis, and social media monitoring.
|
| 23 |
|
| 24 |
+
**Developed by:** Sathwik3
|
| 25 |
|
| 26 |
+
**Model type:** Text Classification (Emotion Detection)
|
| 27 |
|
| 28 |
+
**Language(s):** English
|
| 29 |
|
| 30 |
+
**License:** Apache 2.0
|
| 31 |
|
| 32 |
+
**Base model:** [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased)
|
| 33 |
|
| 34 |
+
## Model Details
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
### Architecture
|
| 37 |
|
| 38 |
+
The model is based on DistilBERT, a distilled version of BERT that retains 97% of BERT's language understanding while being 40% smaller and 60% faster. The architecture consists of:
|
| 39 |
+
- 6 transformer layers
|
| 40 |
+
- 768 hidden dimensions
|
| 41 |
+
- 12 attention heads
|
| 42 |
+
- ~66M parameters
|
| 43 |
+
- Classification head for emotion prediction
|
| 44 |
|
| 45 |
+
### Training Objective
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
The model was fine-tuned using cross-entropy loss for multi-class classification, optimizing for accurate emotion categorization across multiple emotional states.
|
| 48 |
|
| 49 |
+
## Intended Uses
|
| 50 |
|
| 51 |
### Direct Use
|
| 52 |
|
| 53 |
+
The model can be directly used for:
|
| 54 |
+
- **Emotion detection** in text documents
|
| 55 |
+
- **Sentiment analysis** of customer reviews and feedback
|
| 56 |
+
- **Social media monitoring** to understand emotional tone
|
| 57 |
+
- **Content moderation** based on emotional content
|
| 58 |
+
- **Mental health applications** for emotion tracking in journals
|
| 59 |
+
- **Chatbot enhancement** for emotion-aware responses
|
| 60 |
|
| 61 |
+
### Downstream Use
|
| 62 |
|
| 63 |
+
This model can be integrated into larger systems for:
|
| 64 |
+
- Customer service platforms for automated response routing
|
| 65 |
+
- Market research tools for analyzing consumer sentiment
|
| 66 |
+
- Educational platforms for emotional intelligence training
|
| 67 |
+
- Healthcare applications for mental wellness monitoring
|
| 68 |
|
| 69 |
### Out-of-Scope Use
|
| 70 |
|
| 71 |
+
The model should **not** be used for:
|
| 72 |
+
- Clinical diagnosis or medical decision-making
|
| 73 |
+
- Making critical decisions about individuals without human oversight
|
| 74 |
+
- Applications where misclassification could cause harm
|
| 75 |
+
- Languages other than English (without additional fine-tuning)
|
| 76 |
+
- Real-time crisis intervention or emergency response
|
| 77 |
|
| 78 |
+
## Limitations and Bias
|
| 79 |
|
| 80 |
+
### Limitations
|
| 81 |
|
| 82 |
+
- **Language limitation:** The model is trained primarily on English text and may not perform well on other languages or code-switched text
|
| 83 |
+
- **Context sensitivity:** Short texts or texts lacking context may be misclassified
|
| 84 |
+
- **Domain specificity:** Performance may vary across different domains (e.g., formal vs. informal text)
|
| 85 |
+
- **Sarcasm and irony:** The model may struggle with non-literal expressions
|
| 86 |
+
- **Cultural nuances:** Emotion expression varies across cultures, which may affect performance
|
| 87 |
|
| 88 |
+
### Bias Considerations
|
| 89 |
|
| 90 |
+
- The model's predictions may reflect biases present in the training data
|
| 91 |
+
- Emotion categories may not universally apply across all cultures and contexts
|
| 92 |
+
- Performance may vary across demographic groups depending on training data representation
|
| 93 |
+
- Users should validate model outputs, especially in sensitive applications
|
| 94 |
|
| 95 |
+
### Recommendations
|
| 96 |
|
| 97 |
+
- Always review model predictions in high-stakes applications
|
| 98 |
+
- Use the model as a decision support tool, not a sole decision-maker
|
| 99 |
+
- Evaluate performance on your specific use case before deployment
|
| 100 |
+
- Monitor for bias and fairness issues in production
|
| 101 |
+
- Provide clear communication to end users about the model's capabilities and limitations
|
| 102 |
|
| 103 |
## How to Get Started with the Model
|
| 104 |
|
| 105 |
+
Use the code below to get started with the model:
|
|
|
|
|
|
|
| 106 |
|
| 107 |
+
```python
|
| 108 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 109 |
+
import torch
|
| 110 |
|
| 111 |
+
# Load model and tokenizer
|
| 112 |
+
model_name = "Sathwik3/distilbert-emotion-classifier"
|
| 113 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 114 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 115 |
|
| 116 |
+
# Example text
|
| 117 |
+
text = "I am so happy and excited about this amazing opportunity!"
|
| 118 |
|
| 119 |
+
# Tokenize and predict
|
| 120 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
|
| 121 |
+
with torch.no_grad():
|
| 122 |
+
outputs = model(**inputs)
|
| 123 |
+
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
|
| 124 |
+
predicted_class = torch.argmax(predictions, dim=-1).item()
|
| 125 |
|
| 126 |
+
print(f"Predicted emotion class: {predicted_class}")
|
| 127 |
+
print(f"Confidence scores: {predictions}")
|
| 128 |
+
```
|
| 129 |
|
| 130 |
+
For pipeline usage:
|
| 131 |
|
| 132 |
+
```python
|
| 133 |
+
from transformers import pipeline
|
| 134 |
|
| 135 |
+
# Create emotion classification pipeline
|
| 136 |
+
emotion_classifier = pipeline("text-classification", model="Sathwik3/distilbert-emotion-classifier")
|
| 137 |
|
| 138 |
+
# Classify emotion
|
| 139 |
+
result = emotion_classifier("I am so happy and excited about this amazing opportunity!")
|
| 140 |
+
print(result)
|
| 141 |
+
```
|
| 142 |
|
| 143 |
+
## Training Details
|
| 144 |
|
| 145 |
+
### Training Data
|
| 146 |
|
| 147 |
+
The model was fine-tuned on an emotion classification dataset. Specific dataset details:
|
| 148 |
+
- **Dataset:** [Dataset name and link - placeholder for specific information]
|
| 149 |
+
- **Size:** [Number of training examples - placeholder]
|
| 150 |
+
- **Emotion categories:** [List of emotion labels - placeholder]
|
| 151 |
+
- **Data split:** [Train/validation/test split information - placeholder]
|
| 152 |
|
| 153 |
+
### Training Procedure
|
| 154 |
|
| 155 |
+
#### Preprocessing
|
| 156 |
|
| 157 |
+
- Text tokenization using DistilBERT tokenizer
|
| 158 |
+
- Maximum sequence length: 512 tokens
|
| 159 |
+
- Truncation and padding applied as needed
|
| 160 |
+
- Text normalization: [specific preprocessing steps - placeholder]
|
| 161 |
|
| 162 |
+
#### Training Hyperparameters
|
| 163 |
|
| 164 |
+
- **Training regime:** Mixed precision (fp16) [placeholder - adjust if different]
|
| 165 |
+
- **Optimizer:** AdamW
|
| 166 |
+
- **Learning rate:** [e.g., 2e-5 - placeholder]
|
| 167 |
+
- **Batch size:** [e.g., 16 or 32 - placeholder]
|
| 168 |
+
- **Number of epochs:** [e.g., 3-5 - placeholder]
|
| 169 |
+
- **Weight decay:** [e.g., 0.01 - placeholder]
|
| 170 |
+
- **Warmup steps:** [placeholder]
|
| 171 |
+
- **Scheduler:** [e.g., Linear with warmup - placeholder]
|
| 172 |
|
| 173 |
+
#### Training Infrastructure
|
| 174 |
|
| 175 |
+
- **Hardware:** [GPU type, e.g., NVIDIA Tesla V100 - placeholder]
|
| 176 |
+
- **Training time:** [Approximate duration - placeholder]
|
| 177 |
+
- **Framework:** PyTorch with Hugging Face Transformers
|
| 178 |
|
| 179 |
+
## Evaluation
|
| 180 |
|
| 181 |
+
### Testing Data & Metrics
|
| 182 |
|
| 183 |
+
#### Testing Data
|
| 184 |
|
| 185 |
+
- **Test set:** [Description of test data - placeholder]
|
| 186 |
+
- **Test set size:** [Number of examples - placeholder]
|
| 187 |
+
- **Distribution:** [Class distribution information - placeholder]
|
| 188 |
|
| 189 |
#### Metrics
|
| 190 |
|
| 191 |
+
The model's performance is evaluated using:
|
| 192 |
+
- **Accuracy:** Overall classification accuracy
|
| 193 |
+
- **F1 Score:** Macro and weighted F1 scores for balanced evaluation
|
| 194 |
+
- **Precision:** Per-class and average precision
|
| 195 |
+
- **Recall:** Per-class and average recall
|
| 196 |
+
- **Confusion Matrix:** For detailed error analysis
|
| 197 |
|
| 198 |
### Results
|
| 199 |
|
| 200 |
+
#### Overall Performance
|
| 201 |
|
| 202 |
+
| Metric | Value |
|
| 203 |
+
|--------|-------|
|
| 204 |
+
| Accuracy | [e.g., 0.XX - placeholder] |
|
| 205 |
+
| Macro F1 | [e.g., 0.XX - placeholder] |
|
| 206 |
+
| Weighted F1 | [e.g., 0.XX - placeholder] |
|
| 207 |
+
| Macro Precision | [e.g., 0.XX - placeholder] |
|
| 208 |
+
| Macro Recall | [e.g., 0.XX - placeholder] |
|
| 209 |
|
| 210 |
+
#### Per-Class Performance
|
| 211 |
|
| 212 |
+
[Placeholder for per-class metrics table]
|
| 213 |
|
| 214 |
+
| Emotion | Precision | Recall | F1-Score | Support |
|
| 215 |
+
|---------|-----------|--------|----------|----------|
|
| 216 |
+
| [Class 1] | [0.XX] | [0.XX] | [0.XX] | [N] |
|
| 217 |
+
| [Class 2] | [0.XX] | [0.XX] | [0.XX] | [N] |
|
| 218 |
+
| ... | ... | ... | ... | ... |
|
| 219 |
|
| 220 |
+
### Summary
|
| 221 |
|
| 222 |
+
The model demonstrates strong performance on emotion classification tasks, with particular strengths in [specific aspects - placeholder]. Areas for potential improvement include [specific areas - placeholder].
|
| 223 |
|
| 224 |
## Environmental Impact
|
| 225 |
|
|
|
|
|
|
|
| 226 |
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 227 |
|
| 228 |
+
- **Hardware Type:** [e.g., NVIDIA Tesla V100 - placeholder]
|
| 229 |
+
- **Hours used:** [placeholder]
|
| 230 |
+
- **Cloud Provider:** [e.g., AWS, GCP, Azure, or on-premises - placeholder]
|
| 231 |
+
- **Compute Region:** [e.g., us-east-1 - placeholder]
|
| 232 |
+
- **Carbon Emitted:** [e.g., XX kg CO2eq - placeholder]
|
| 233 |
|
| 234 |
+
## Technical Specifications
|
| 235 |
|
| 236 |
+
### Model Architecture
|
| 237 |
|
| 238 |
+
- **Base Model:** DistilBERT (distilbert-base-uncased)
|
| 239 |
+
- **Model Size:** ~66M parameters (base) + classification head
|
| 240 |
+
- **Layers:** 6 transformer layers
|
| 241 |
+
- **Hidden Size:** 768
|
| 242 |
+
- **Attention Heads:** 12
|
| 243 |
+
- **Intermediate Size:** 3072
|
| 244 |
+
- **Max Sequence Length:** 512 tokens
|
| 245 |
+
- **Vocabulary Size:** 30,522 tokens
|
| 246 |
|
| 247 |
### Compute Infrastructure
|
| 248 |
|
|
|
|
|
|
|
| 249 |
#### Hardware
|
| 250 |
|
| 251 |
+
[Placeholder for specific hardware information - e.g., GPU type, CPU, memory]
|
| 252 |
|
| 253 |
#### Software
|
| 254 |
|
| 255 |
+
- **Framework:** PyTorch
|
| 256 |
+
- **Library:** Hugging Face Transformers
|
| 257 |
+
- **Python Version:** [e.g., 3.8+ - placeholder]
|
| 258 |
+
- **Key Dependencies:**
|
| 259 |
+
- transformers
|
| 260 |
+
- torch
|
| 261 |
+
- tokenizers
|
| 262 |
+
- datasets (if applicable)
|
| 263 |
|
| 264 |
+
## Citation
|
| 265 |
|
| 266 |
+
If you use this model in your research or applications, please cite:
|
| 267 |
|
| 268 |
**BibTeX:**
|
| 269 |
|
| 270 |
+
```bibtex
|
| 271 |
+
@misc{sathwik3-distilbert-emotion,
|
| 272 |
+
author = {Sathwik3},
|
| 273 |
+
title = {DistilBERT Emotion Classifier},
|
| 274 |
+
year = {2024},
|
| 275 |
+
publisher = {Hugging Face},
|
| 276 |
+
howpublished = {\url{https://huggingface.co/Sathwik3/distilbert-emotion-classifier}}
|
| 277 |
+
}
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
Please also cite the original DistilBERT paper:
|
| 281 |
+
|
| 282 |
+
```bibtex
|
| 283 |
+
@article{sanh2019distilbert,
|
| 284 |
+
title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
|
| 285 |
+
author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
|
| 286 |
+
journal={arXiv preprint arXiv:1910.01108},
|
| 287 |
+
year={2019}
|
| 288 |
+
}
|
| 289 |
+
```
|
| 290 |
|
| 291 |
**APA:**
|
| 292 |
|
| 293 |
+
Sathwik3. (2024). *DistilBERT Emotion Classifier*. Hugging Face. https://huggingface.co/Sathwik3/distilbert-emotion-classifier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
|
| 295 |
+
## Model Card Authors
|
| 296 |
|
| 297 |
+
Sathwik3
|
| 298 |
|
| 299 |
+
## Model Card Contact
|
| 300 |
|
| 301 |
+
For questions or feedback about this model, please open an issue in the model's repository or contact via Hugging Face.
|
| 302 |
|
| 303 |
+
---
|
| 304 |
|
| 305 |
+
*This model card follows the guidelines from [Mitchell et al. (2019)](https://arxiv.org/abs/1810.03993) and the Hugging Face Model Card template.*
|