File size: 2,836 Bytes
cd71544
 
 
 
 
7ee1267
cd71544
 
7ee1267
cd71544
 
 
7ee1267
 
 
 
cd71544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
853c418
cd71544
7152465
bec7fe5
6e2c902
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bec7fe5
cd71544
 
 
853c418
cd71544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7ee1267
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
license: apache-2.0
base_model: distilbert-base-uncased
tags:
- generated_from_trainer
- emotion_classfication
metrics:
- accuracy
- f1
model-index:
- name: distilbert-base-uncased-finetuned-emotion-classification-10_epochs
  results: []
datasets:
- dair-ai/emotion
language:
- en
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# distilbert-base-uncased-finetuned-emotion-classification-10_epochs

This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on an unknown dataset.
It achieves the following results on the evaluation set:
- Loss: 0.1464
- Accuracy: 0.9375
- F1 score: 0.9376

## Model description

This model is fine-tuned on the 'emotion' dataset to classify text into six emotion categories: sadness, joy, love, anger, fear, and surprise.

## Use the Model
```python
from transformers import pipeline
import pandas as pd
emt_clf = pipeline("text-classification", model="Swoodplays/emotion-classification")

text = "I saw a movie today and it was really good."

preds = emt_clf(text, return_all_scores=True)
labels = ['sadness', 'joy', 'love', 'anger', 'fear', 'surprise']

print(preds)

preds_df = pd.DataFrame(preds[0])
plt.bar(labels, 100 * preds_df["score"])
plt.title(f'"{text}"')
plt.xlabel("Classfied emotions")
plt.ylabel("Class probability (%)")
plt.show()
```

## Training and evaluation data

dair-ai/emotion 

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 128
- eval_batch_size: 128
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 10

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 score |
|:-------------:|:-----:|:----:|:---------------:|:--------:|:--------:|
| No log        | 1.0   | 125  | 0.4449          | 0.873    | 0.8654   |
| No log        | 2.0   | 250  | 0.2166          | 0.9265   | 0.9270   |
| No log        | 3.0   | 375  | 0.1726          | 0.933    | 0.9339   |
| No log        | 4.0   | 500  | 0.1552          | 0.9385   | 0.9386   |
| No log        | 5.0   | 625  | 0.1439          | 0.938    | 0.9383   |
| No log        | 6.0   | 750  | 0.1435          | 0.937    | 0.9370   |
| No log        | 7.0   | 875  | 0.1481          | 0.9355   | 0.9356   |
| No log        | 8.0   | 1000 | 0.1402          | 0.935    | 0.9352   |
| No log        | 9.0   | 1125 | 0.1491          | 0.9355   | 0.9355   |
| No log        | 10.0  | 1250 | 0.1464          | 0.9375   | 0.9376   |


### Framework versions

- Transformers 4.44.0
- Pytorch 2.4.0
- Datasets 2.21.0
- Tokenizers 0.19.1