Update README.md
Browse files
README.md
CHANGED
@@ -17,7 +17,7 @@ metrics:
|
|
17 |
- recall
|
18 |
- matthews_correlation
|
19 |
base_model:
|
20 |
-
- answerdotai/ModernBERT-
|
21 |
widget:
|
22 |
- text: I am thrilled to be a part of this amazing journey!
|
23 |
- text: I feel so disappointed with the results.
|
@@ -30,13 +30,13 @@ library_name: transformers
|
|
30 |
|
31 |
### Overview
|
32 |
|
33 |
-
This model was fine-tuned from [ModernBERT-
|
34 |
|
35 |
---
|
36 |
|
37 |
### Model Details
|
38 |
|
39 |
-
- **Base Model**: [ModernBERT-
|
40 |
- **Fine-Tuning Dataset**: [GoEmotions](https://huggingface.co/datasets/go_emotions)
|
41 |
- **Number of Labels**: 28
|
42 |
- **Problem Type**: Multi-label classification
|
@@ -57,7 +57,7 @@ import torch
|
|
57 |
# Load the model
|
58 |
classifier = pipeline(
|
59 |
"text-classification",
|
60 |
-
model="cirimus/modernbert-
|
61 |
return_all_scores=True
|
62 |
)
|
63 |
|
@@ -74,15 +74,13 @@ for pred in top_5:
|
|
74 |
|
75 |
# Example output:
|
76 |
# Top 5 emotions detected:
|
77 |
-
#
|
78 |
-
#
|
79 |
-
#
|
80 |
-
#
|
81 |
-
#
|
82 |
```
|
83 |
|
84 |
-
|
85 |
-
|
86 |
### How the Model Was Created
|
87 |
|
88 |
The model was fine-tuned for 3 epochs using the following hyperparameters:
|
@@ -90,7 +88,6 @@ The model was fine-tuned for 3 epochs using the following hyperparameters:
|
|
90 |
- **Learning Rate**: `2e-5`
|
91 |
- **Batch Size**: 16
|
92 |
- **Weight Decay**: `0.01`
|
93 |
-
- **Warmup Steps**: 500
|
94 |
- **Optimizer**: AdamW
|
95 |
- **Evaluation Metrics**: Precision, Recall, F1 Score (weighted), Accuracy
|
96 |
|
@@ -112,88 +109,88 @@ The model was evaluated on the test split of the GoEmotions dataset, using a thr
|
|
112 |
Using the default threshold of 0.5.
|
113 |
|
114 |
*Macro Averages (test)*
|
115 |
-
- Accuracy: `0.
|
116 |
-
- Precision: `0.
|
117 |
-
- Recall: `0.
|
118 |
-
- F1: `0.
|
119 |
-
- MCC: `0.
|
120 |
|
121 |
*Per-Label Results (test)*
|
122 |
|
123 |
| Label | Accuracy | Precision | Recall | F1 | MCC | Support | Threshold |
|
124 |
|----------------|----------|-----------|--------|-------|-------|---------|-----------|
|
125 |
-
| admiration | 0.
|
126 |
-
| amusement | 0.
|
127 |
-
| anger | 0.968 | 0.
|
128 |
-
| annoyance | 0.
|
129 |
-
| approval | 0.
|
130 |
-
| caring | 0.
|
131 |
-
| confusion | 0.
|
132 |
-
| curiosity | 0.
|
133 |
-
| desire | 0.
|
134 |
-
| disappointment | 0.
|
135 |
-
| disapproval | 0.
|
136 |
-
| disgust | 0.
|
137 |
-
| embarrassment | 0.995 | 0.
|
138 |
-
| excitement | 0.
|
139 |
-
| fear | 0.
|
140 |
-
| gratitude | 0.990 | 0.
|
141 |
| grief | 0.999 | 0.000 | 0.000 | 0.000 | 0.000 | 6 | 0.5 |
|
142 |
-
| joy | 0.
|
143 |
-
| love | 0.
|
144 |
-
| nervousness | 0.996 | 0.
|
145 |
-
| optimism | 0.
|
146 |
-
| pride | 0.998 | 0.
|
147 |
-
| realization | 0.
|
148 |
-
| relief | 0.998 |
|
149 |
-
| remorse | 0.992 | 0.
|
150 |
-
| sadness | 0.
|
151 |
-
| surprise | 0.
|
152 |
-
| neutral | 0.
|
153 |
|
154 |
**Optimal Results**:
|
155 |
|
156 |
Using the best threshold for each label based on the training set (tuned on F1).
|
157 |
|
158 |
*Macro Averages (test)*
|
159 |
-
- Accuracy: `0.
|
160 |
-
- Precision: `0.
|
161 |
-
- Recall: `0.
|
162 |
-
- F1: `0.
|
163 |
-
- MCC: `0.
|
164 |
|
165 |
*Per-Label Results (test)*
|
166 |
|
167 |
| Label | Accuracy | Precision | Recall | F1 | MCC | Support | Threshold |
|
168 |
|----------------|----------|-----------|--------|-------|-------|---------|-----------|
|
169 |
-
| admiration | 0.
|
170 |
-
| amusement | 0.
|
171 |
-
| anger | 0.
|
172 |
-
| annoyance | 0.
|
173 |
-
| approval | 0.
|
174 |
-
| caring | 0.
|
175 |
-
| confusion | 0.
|
176 |
-
| curiosity | 0.
|
177 |
-
| desire | 0.988 | 0.
|
178 |
-
| disappointment | 0.
|
179 |
-
| disapproval | 0.
|
180 |
-
| disgust | 0.
|
181 |
-
| embarrassment | 0.
|
182 |
-
| excitement | 0.
|
183 |
-
| fear | 0.
|
184 |
-
| gratitude | 0.990 | 0.
|
185 |
-
| grief | 0.999 | 0.
|
186 |
-
| joy | 0.
|
187 |
-
| love | 0.982 | 0.
|
188 |
-
| nervousness | 0.995 | 0.
|
189 |
-
| optimism | 0.
|
190 |
-
| pride | 0.998 | 0.
|
191 |
-
| realization | 0.
|
192 |
-
| relief | 0.
|
193 |
-
| remorse | 0.993 | 0.
|
194 |
-
| sadness | 0.
|
195 |
-
| surprise | 0.
|
196 |
-
| neutral | 0.
|
197 |
|
198 |
|
199 |
---
|
@@ -222,7 +219,7 @@ The model is designed for emotion classification in English-language text, parti
|
|
222 |
|
223 |
- **Hardware Used**: NVIDIA RTX4090
|
224 |
- **Training Time**: <1 hour
|
225 |
-
- **Carbon Emissions**: ~0.
|
226 |
|
227 |
---
|
228 |
|
@@ -235,5 +232,5 @@ If you use this model, please cite it as follows:
|
|
235 |
title = {Emotion Classification with ModernBERT},
|
236 |
author = {Enric Junqu\'e de Fortuny},
|
237 |
year = {2025},
|
238 |
-
howpublished = {\url{https://huggingface.co/cirimus/modernbert-
|
239 |
}
|
|
|
17 |
- recall
|
18 |
- matthews_correlation
|
19 |
base_model:
|
20 |
+
- answerdotai/ModernBERT-large
|
21 |
widget:
|
22 |
- text: I am thrilled to be a part of this amazing journey!
|
23 |
- text: I feel so disappointed with the results.
|
|
|
30 |
|
31 |
### Overview
|
32 |
|
33 |
+
This model was fine-tuned from [ModernBERT-large](https://huggingface.co/answerdotai/ModernBERT-large) on the [GoEmotions](https://huggingface.co/datasets/google-research-datasets/go_emotions) dataset for multi-label classification. It predicts emotional states in text, with a total of 28 possible labels. Each input text can have one or more associated labels, reflecting the multi-label nature of the task.
|
34 |
|
35 |
---
|
36 |
|
37 |
### Model Details
|
38 |
|
39 |
+
- **Base Model**: [ModernBERT-large](https://huggingface.co/answerdotai/ModernBERT-large)
|
40 |
- **Fine-Tuning Dataset**: [GoEmotions](https://huggingface.co/datasets/go_emotions)
|
41 |
- **Number of Labels**: 28
|
42 |
- **Problem Type**: Multi-label classification
|
|
|
57 |
# Load the model
|
58 |
classifier = pipeline(
|
59 |
"text-classification",
|
60 |
+
model="cirimus/modernbert-large-go-emotions",
|
61 |
return_all_scores=True
|
62 |
)
|
63 |
|
|
|
74 |
|
75 |
# Example output:
|
76 |
# Top 5 emotions detected:
|
77 |
+
# joy: 0.784
|
78 |
+
# excitement: 0.735
|
79 |
+
# admiration: 0.013
|
80 |
+
# gratitude: 0.003
|
81 |
+
# amusement: 0.003
|
82 |
```
|
83 |
|
|
|
|
|
84 |
### How the Model Was Created
|
85 |
|
86 |
The model was fine-tuned for 3 epochs using the following hyperparameters:
|
|
|
88 |
- **Learning Rate**: `2e-5`
|
89 |
- **Batch Size**: 16
|
90 |
- **Weight Decay**: `0.01`
|
|
|
91 |
- **Optimizer**: AdamW
|
92 |
- **Evaluation Metrics**: Precision, Recall, F1 Score (weighted), Accuracy
|
93 |
|
|
|
109 |
Using the default threshold of 0.5.
|
110 |
|
111 |
*Macro Averages (test)*
|
112 |
+
- Accuracy: `0.971`
|
113 |
+
- Precision: `0.611`
|
114 |
+
- Recall: `0.410`
|
115 |
+
- F1: `0.472`
|
116 |
+
- MCC: `0.475`
|
117 |
|
118 |
*Per-Label Results (test)*
|
119 |
|
120 |
| Label | Accuracy | Precision | Recall | F1 | MCC | Support | Threshold |
|
121 |
|----------------|----------|-----------|--------|-------|-------|---------|-----------|
|
122 |
+
| admiration | 0.946 | 0.739 | 0.653 | 0.693 | 0.666 | 504 | 0.5 |
|
123 |
+
| amusement | 0.982 | 0.817 | 0.814 | 0.816 | 0.807 | 264 | 0.5 |
|
124 |
+
| anger | 0.968 | 0.671 | 0.237 | 0.351 | 0.387 | 198 | 0.5 |
|
125 |
+
| annoyance | 0.938 | 0.449 | 0.191 | 0.268 | 0.265 | 320 | 0.5 |
|
126 |
+
| approval | 0.940 | 0.564 | 0.302 | 0.393 | 0.384 | 351 | 0.5 |
|
127 |
+
| caring | 0.977 | 0.581 | 0.319 | 0.411 | 0.420 | 135 | 0.5 |
|
128 |
+
| confusion | 0.973 | 0.553 | 0.307 | 0.395 | 0.400 | 153 | 0.5 |
|
129 |
+
| curiosity | 0.952 | 0.551 | 0.454 | 0.498 | 0.476 | 284 | 0.5 |
|
130 |
+
| desire | 0.988 | 0.702 | 0.398 | 0.508 | 0.523 | 83 | 0.5 |
|
131 |
+
| disappointment | 0.972 | 0.500 | 0.152 | 0.234 | 0.265 | 151 | 0.5 |
|
132 |
+
| disapproval | 0.951 | 0.503 | 0.315 | 0.387 | 0.374 | 267 | 0.5 |
|
133 |
+
| disgust | 0.981 | 0.685 | 0.301 | 0.418 | 0.446 | 123 | 0.5 |
|
134 |
+
| embarrassment | 0.995 | 0.800 | 0.324 | 0.462 | 0.507 | 37 | 0.5 |
|
135 |
+
| excitement | 0.983 | 0.649 | 0.233 | 0.343 | 0.382 | 103 | 0.5 |
|
136 |
+
| fear | 0.991 | 0.738 | 0.577 | 0.647 | 0.648 | 78 | 0.5 |
|
137 |
+
| gratitude | 0.990 | 0.955 | 0.895 | 0.924 | 0.919 | 352 | 0.5 |
|
138 |
| grief | 0.999 | 0.000 | 0.000 | 0.000 | 0.000 | 6 | 0.5 |
|
139 |
+
| joy | 0.980 | 0.658 | 0.646 | 0.652 | 0.642 | 161 | 0.5 |
|
140 |
+
| love | 0.983 | 0.795 | 0.815 | 0.805 | 0.796 | 238 | 0.5 |
|
141 |
+
| nervousness | 0.996 | 0.556 | 0.435 | 0.488 | 0.490 | 23 | 0.5 |
|
142 |
+
| optimism | 0.973 | 0.702 | 0.392 | 0.503 | 0.513 | 186 | 0.5 |
|
143 |
+
| pride | 0.998 | 0.800 | 0.250 | 0.381 | 0.446 | 16 | 0.5 |
|
144 |
+
| realization | 0.972 | 0.405 | 0.117 | 0.182 | 0.207 | 145 | 0.5 |
|
145 |
+
| relief | 0.998 | 0.000 | 0.000 | 0.000 | 0.000 | 11 | 0.5 |
|
146 |
+
| remorse | 0.992 | 0.566 | 0.839 | 0.676 | 0.686 | 56 | 0.5 |
|
147 |
+
| sadness | 0.980 | 0.764 | 0.436 | 0.555 | 0.568 | 156 | 0.5 |
|
148 |
+
| surprise | 0.980 | 0.692 | 0.447 | 0.543 | 0.547 | 141 | 0.5 |
|
149 |
+
| neutral | 0.796 | 0.716 | 0.628 | 0.669 | 0.525 | 1787 | 0.5 |
|
150 |
|
151 |
**Optimal Results**:
|
152 |
|
153 |
Using the best threshold for each label based on the training set (tuned on F1).
|
154 |
|
155 |
*Macro Averages (test)*
|
156 |
+
- Accuracy: `0.968`
|
157 |
+
- Precision: `0.591`
|
158 |
+
- Recall: `0.528`
|
159 |
+
- F1: `0.550`
|
160 |
+
- MCC: `0.536`
|
161 |
|
162 |
*Per-Label Results (test)*
|
163 |
|
164 |
| Label | Accuracy | Precision | Recall | F1 | MCC | Support | Threshold |
|
165 |
|----------------|----------|-----------|--------|-------|-------|---------|-----------|
|
166 |
+
| admiration | 0.947 | 0.722 | 0.702 | 0.712 | 0.683 | 504 | 0.40 |
|
167 |
+
| amusement | 0.983 | 0.812 | 0.848 | 0.830 | 0.821 | 264 | 0.45 |
|
168 |
+
| anger | 0.966 | 0.548 | 0.460 | 0.500 | 0.485 | 198 | 0.25 |
|
169 |
+
| annoyance | 0.926 | 0.378 | 0.403 | 0.390 | 0.351 | 320 | 0.30 |
|
170 |
+
| approval | 0.928 | 0.445 | 0.470 | 0.457 | 0.419 | 351 | 0.30 |
|
171 |
+
| caring | 0.975 | 0.496 | 0.430 | 0.460 | 0.449 | 135 | 0.35 |
|
172 |
+
| confusion | 0.966 | 0.417 | 0.510 | 0.459 | 0.444 | 153 | 0.30 |
|
173 |
+
| curiosity | 0.950 | 0.522 | 0.588 | 0.553 | 0.528 | 284 | 0.40 |
|
174 |
+
| desire | 0.988 | 0.673 | 0.422 | 0.519 | 0.527 | 83 | 0.40 |
|
175 |
+
| disappointment | 0.964 | 0.338 | 0.305 | 0.321 | 0.303 | 151 | 0.30 |
|
176 |
+
| disapproval | 0.948 | 0.468 | 0.416 | 0.440 | 0.414 | 267 | 0.35 |
|
177 |
+
| disgust | 0.978 | 0.529 | 0.447 | 0.485 | 0.475 | 123 | 0.25 |
|
178 |
+
| embarrassment | 0.994 | 0.650 | 0.351 | 0.456 | 0.475 | 37 | 0.35 |
|
179 |
+
| excitement | 0.978 | 0.419 | 0.427 | 0.423 | 0.412 | 103 | 0.25 |
|
180 |
+
| fear | 0.990 | 0.662 | 0.628 | 0.645 | 0.640 | 78 | 0.40 |
|
181 |
+
| gratitude | 0.990 | 0.955 | 0.895 | 0.924 | 0.919 | 352 | 0.50 |
|
182 |
+
| grief | 0.999 | 0.750 | 0.500 | 0.600 | 0.612 | 6 | 0.35 |
|
183 |
+
| joy | 0.980 | 0.660 | 0.640 | 0.650 | 0.639 | 161 | 0.50 |
|
184 |
+
| love | 0.982 | 0.774 | 0.836 | 0.804 | 0.795 | 238 | 0.45 |
|
185 |
+
| nervousness | 0.995 | 0.435 | 0.435 | 0.435 | 0.432 | 23 | 0.45 |
|
186 |
+
| optimism | 0.972 | 0.597 | 0.565 | 0.580 | 0.566 | 186 | 0.25 |
|
187 |
+
| pride | 0.998 | 0.667 | 0.375 | 0.480 | 0.499 | 16 | 0.15 |
|
188 |
+
| realization | 0.962 | 0.273 | 0.248 | 0.260 | 0.241 | 145 | 0.25 |
|
189 |
+
| relief | 0.999 | 0.800 | 0.364 | 0.500 | 0.539 | 11 | 0.25 |
|
190 |
+
| remorse | 0.993 | 0.641 | 0.732 | 0.683 | 0.681 | 56 | 0.65 |
|
191 |
+
| sadness | 0.978 | 0.646 | 0.538 | 0.587 | 0.579 | 156 | 0.30 |
|
192 |
+
| surprise | 0.979 | 0.603 | 0.518 | 0.557 | 0.548 | 141 | 0.40 |
|
193 |
+
| neutral | 0.791 | 0.669 | 0.722 | 0.695 | 0.537 | 1787 | 0.40 |
|
194 |
|
195 |
|
196 |
---
|
|
|
219 |
|
220 |
- **Hardware Used**: NVIDIA RTX4090
|
221 |
- **Training Time**: <1 hour
|
222 |
+
- **Carbon Emissions**: ~0.06 kg CO2 (calculated via [ML CO2 Impact Calculator](https://mlco2.github.io/impact)).
|
223 |
|
224 |
---
|
225 |
|
|
|
232 |
title = {Emotion Classification with ModernBERT},
|
233 |
author = {Enric Junqu\'e de Fortuny},
|
234 |
year = {2025},
|
235 |
+
howpublished = {\url{https://huggingface.co/cirimus/modernbert-large-go-emotions}},
|
236 |
}
|