Add fine-tuned emotion classification model with 78.3% accuracy
Browse files- README.md +58 -0
- config.json +40 -0
- model.safetensors +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +56 -0
- training_args.bin +3 -0
- vocab.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- emotion-classification
|
| 7 |
+
- distilbert
|
| 8 |
+
- text-classification
|
| 9 |
+
- fine-tuned
|
| 10 |
+
datasets:
|
| 11 |
+
- go_emotions
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Emotion Classification with DistilBERT
|
| 15 |
+
|
| 16 |
+
This model is a fine-tuned version of distilbert-base-uncased for emotion classification. It classifies text into 6 emotions:
|
| 17 |
+
|
| 18 |
+
- 0: admiration
|
| 19 |
+
- 1: amusement
|
| 20 |
+
- 2: anger
|
| 21 |
+
- 3: annoyance
|
| 22 |
+
- 4: approval
|
| 23 |
+
- 5: caring
|
| 24 |
+
|
| 25 |
+
## Training Data
|
| 26 |
+
The model was fine-tuned on the Go Emotions dataset, filtered to these 6 emotion categories.
|
| 27 |
+
|
| 28 |
+
## Performance
|
| 29 |
+
- **Accuracy: 78.3%**
|
| 30 |
+
- **F1 Score: 77.9%**
|
| 31 |
+
- **Training Loss: 0.45** (from 0.93)
|
| 32 |
+
|
| 33 |
+
## Usage
|
| 34 |
+
```python
|
| 35 |
+
from transformers import pipeline
|
| 36 |
+
|
| 37 |
+
classifier = pipeline('text-classification', model='your-username/emotion-classifier-distilbert')
|
| 38 |
+
result = classifier('I love this amazing product!')
|
| 39 |
+
print(f"Emotion: {result[0]['label']}, Confidence: {result[0]['score']:.3f}")
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
## Example Predictions
|
| 43 |
+
- 'I love this so much!' → admiration (confidence: ~0.85)
|
| 44 |
+
- 'This is so frustrating!' → anger (confidence: ~0.82)
|
| 45 |
+
- 'That's hilarious!' → amusement (confidence: ~0.88)
|
| 46 |
+
- 'This is annoying me' → annoyance (confidence: ~0.79)
|
| 47 |
+
- 'Great job on this!' → approval (confidence: ~0.81)
|
| 48 |
+
- 'I'm here to support you' → caring (confidence: ~0.83)
|
| 49 |
+
|
| 50 |
+
## Training Details
|
| 51 |
+
- **Base Model**: distilbert-base-uncased
|
| 52 |
+
- **Epochs**: 3
|
| 53 |
+
- **Batch Size**: 16
|
| 54 |
+
- **Learning Rate**: 2e-5
|
| 55 |
+
- **Dataset**: Go Emotions (filtered)
|
| 56 |
+
|
| 57 |
+
## Intended Use
|
| 58 |
+
This model is suitable for emotion analysis in text, customer feedback analysis, sentiment-aware chatbots, and social media monitoring.
|
config.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"DistilBertForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.1,
|
| 7 |
+
"dim": 768,
|
| 8 |
+
"dropout": 0.1,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"hidden_dim": 3072,
|
| 11 |
+
"id2label": {
|
| 12 |
+
"0": "LABEL_0",
|
| 13 |
+
"1": "LABEL_1",
|
| 14 |
+
"2": "LABEL_2",
|
| 15 |
+
"3": "LABEL_3",
|
| 16 |
+
"4": "LABEL_4",
|
| 17 |
+
"5": "LABEL_5"
|
| 18 |
+
},
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"label2id": {
|
| 21 |
+
"LABEL_0": 0,
|
| 22 |
+
"LABEL_1": 1,
|
| 23 |
+
"LABEL_2": 2,
|
| 24 |
+
"LABEL_3": 3,
|
| 25 |
+
"LABEL_4": 4,
|
| 26 |
+
"LABEL_5": 5
|
| 27 |
+
},
|
| 28 |
+
"max_position_embeddings": 512,
|
| 29 |
+
"model_type": "distilbert",
|
| 30 |
+
"n_heads": 12,
|
| 31 |
+
"n_layers": 6,
|
| 32 |
+
"pad_token_id": 0,
|
| 33 |
+
"problem_type": "single_label_classification",
|
| 34 |
+
"qa_dropout": 0.1,
|
| 35 |
+
"seq_classif_dropout": 0.2,
|
| 36 |
+
"sinusoidal_pos_embds": false,
|
| 37 |
+
"tie_weights_": true,
|
| 38 |
+
"transformers_version": "4.56.2",
|
| 39 |
+
"vocab_size": 30522
|
| 40 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c225003277f224f8610a7e92c4c43bf78d1397deed0857e6ee558943d4618fec
|
| 3 |
+
size 267844872
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cls_token": "[CLS]",
|
| 3 |
+
"mask_token": "[MASK]",
|
| 4 |
+
"pad_token": "[PAD]",
|
| 5 |
+
"sep_token": "[SEP]",
|
| 6 |
+
"unk_token": "[UNK]"
|
| 7 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "[PAD]",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"100": {
|
| 12 |
+
"content": "[UNK]",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"101": {
|
| 20 |
+
"content": "[CLS]",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"102": {
|
| 28 |
+
"content": "[SEP]",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"103": {
|
| 36 |
+
"content": "[MASK]",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"clean_up_tokenization_spaces": false,
|
| 45 |
+
"cls_token": "[CLS]",
|
| 46 |
+
"do_lower_case": true,
|
| 47 |
+
"extra_special_tokens": {},
|
| 48 |
+
"mask_token": "[MASK]",
|
| 49 |
+
"model_max_length": 512,
|
| 50 |
+
"pad_token": "[PAD]",
|
| 51 |
+
"sep_token": "[SEP]",
|
| 52 |
+
"strip_accents": null,
|
| 53 |
+
"tokenize_chinese_chars": true,
|
| 54 |
+
"tokenizer_class": "DistilBertTokenizer",
|
| 55 |
+
"unk_token": "[UNK]"
|
| 56 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d8a67a81a8453bb92521981808139c8f6f56036424ae4fd1ab9a0a5962297e76
|
| 3 |
+
size 5777
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|