hamzawaheed
commited on
Commit
•
f954d46
1
Parent(s):
df3ea39
Training in progress, epoch 1
Browse files- README.md +37 -103
- model.safetensors +1 -1
- training_args.bin +2 -2
README.md
CHANGED
@@ -3,127 +3,61 @@ library_name: transformers
|
|
3 |
license: apache-2.0
|
4 |
base_model: distilbert-base-uncased
|
5 |
tags:
|
6 |
-
|
7 |
-
- text-classification
|
8 |
-
- distilbert
|
9 |
metrics:
|
10 |
-
|
|
|
|
|
|
|
11 |
---
|
12 |
|
|
|
|
|
|
|
13 |
# emotion-classification-model
|
14 |
|
15 |
-
This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased).
|
16 |
It achieves the following results on the evaluation set:
|
17 |
-
-
|
18 |
-
-
|
19 |
-
|
20 |
-
## Model Description
|
21 |
-
|
22 |
-
The **Emotion Classification Model** is a fine-tuned version of the `distilbert-base-uncased` transformer architecture, adapted specifically for classifying text into six distinct emotions. DistilBERT, a distilled version of BERT, offers a lightweight yet powerful foundation, enabling efficient training and inference without significant loss in performance.
|
23 |
-
|
24 |
-
This model leverages the pre-trained language understanding capabilities of DistilBERT to accurately categorize textual data into the following emotion classes:
|
25 |
-
|
26 |
-
- **Joy**
|
27 |
-
- **Sadness**
|
28 |
-
- **Anger**
|
29 |
-
- **Fear**
|
30 |
-
- **Surprise**
|
31 |
-
- **Disgust**
|
32 |
-
|
33 |
-
By fine-tuning on the `dair-ai/emotion` dataset, the model has been optimized to recognize and differentiate subtle emotional cues in various text inputs, making it suitable for applications that require nuanced sentiment analysis and emotional intelligence.
|
34 |
-
|
35 |
-
## Intended Uses & Limitations
|
36 |
-
|
37 |
-
### Intended Uses
|
38 |
-
|
39 |
-
The Emotion Classification Model is designed for a variety of applications where understanding the emotional tone of text is crucial. Suitable use cases include:
|
40 |
-
|
41 |
-
- **Sentiment Analysis:** Gauging customer feedback, reviews, and social media posts to understand emotional responses.
|
42 |
-
- **Mental Health Monitoring:** Assisting therapists and counselors by analyzing patient communications for emotional indicators.
|
43 |
-
- **Social Media Analysis:** Tracking and analyzing emotional trends and public sentiment across platforms like Twitter, Facebook, and Instagram.
|
44 |
-
- **Content Recommendation:** Enhancing recommendation systems by aligning content suggestions with users' current emotional states.
|
45 |
-
- **Chatbots and Virtual Assistants:** Enabling more empathetic and emotionally aware interactions with users.
|
46 |
-
|
47 |
-
### Limitations
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
- **Contextual Understanding:** The model analyzes text in isolation and may struggle with understanding nuanced emotions that depend on broader conversational context or preceding interactions.
|
53 |
-
- **Language Constraints:** Currently optimized for English, limiting its effectiveness with multilingual or non-English inputs without further training or adaptation.
|
54 |
-
- **Emotion Overlap:** Some emotions have overlapping linguistic cues, which may lead to misclassifications in complex or ambiguous text scenarios.
|
55 |
-
- **Dependence on Text Quality:** The model's performance can degrade with poorly structured, slang-heavy, or highly informal text inputs.
|
56 |
|
57 |
-
##
|
58 |
|
59 |
-
|
60 |
|
61 |
-
|
62 |
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
- **Training Set:** 15,000 samples
|
67 |
-
- **Validation Set:** 2,000 samples
|
68 |
-
- **Test Set:** 2,000 samples
|
69 |
-
- **Emotion Classes:** 6
|
70 |
-
- **Joy:** 3,000 samples
|
71 |
-
- **Sadness:** 3,500 samples
|
72 |
-
- **Anger:** 2,500 samples
|
73 |
-
- **Fear:** 2,000 samples
|
74 |
-
- **Surprise:** 4,000 samples
|
75 |
-
- **Disgust:** 2,000 samples
|
76 |
|
77 |
-
###
|
78 |
-
|
79 |
-
Prior to training, the dataset underwent the following preprocessing steps:
|
80 |
-
|
81 |
-
1. **Tokenization:** Utilized the `DistilBertTokenizerFast` from the `distilbert-base-uncased` model to tokenize the input text. Each text sample was converted into token IDs, ensuring compatibility with the DistilBERT architecture.
|
82 |
-
2. **Padding & Truncation:** Applied padding and truncation to maintain a uniform sequence length of 32 tokens. This step ensures efficient batching and consistent input dimensions for the model.
|
83 |
-
3. **Batch Processing:** Employed parallel processing using all available CPU cores minus one to expedite the tokenization process across training, validation, and test sets.
|
84 |
-
4. **Format Conversion:** Converted the tokenized datasets into PyTorch tensors to facilitate seamless integration with the PyTorch-based `Trainer` API.
|
85 |
-
|
86 |
-
### Evaluation Metrics
|
87 |
-
|
88 |
-
The model's performance was assessed using the following metrics:
|
89 |
-
|
90 |
-
- **Accuracy:** Measures the proportion of correctly predicted samples out of the total samples.
|
91 |
-
|
92 |
-
## Training Procedure
|
93 |
-
|
94 |
-
### Training Hyperparameters
|
95 |
|
96 |
The following hyperparameters were used during training:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
|
99 |
-
- **Training Batch Size:** `16` per device
|
100 |
-
- **Evaluation Batch Size:** `32` per device
|
101 |
-
- **Number of Epochs:** `2`
|
102 |
-
- **Weight Decay:** `0.01`
|
103 |
-
- **Learning Rate Scheduler:** `Linear`
|
104 |
-
- **Gradient Accumulation Steps:** `2` (effectively simulating a batch size of `32`)
|
105 |
-
- **Mixed Precision Training:** Enabled (Native AMP) if CUDA is available
|
106 |
-
|
107 |
-
### Optimization Strategies
|
108 |
-
|
109 |
-
- **Mixed Precision Training:** Utilized PyTorch's Native AMP to accelerate training and reduce memory consumption when a CUDA-enabled GPU is available.
|
110 |
-
- **Gradient Accumulation:** Implemented gradient accumulation with `2` steps to effectively increase the batch size without exceeding GPU memory limits.
|
111 |
-
- **Early Stopping:** Incorporated `EarlyStoppingCallback` with a patience of `2` epochs to halt training if the validation loss does not improve, preventing overfitting.
|
112 |
-
- **Checkpointing:** Configured to save model checkpoints at the end of each epoch, retaining only the two most recent checkpoints to manage storage efficiently.
|
113 |
-
|
114 |
-
### Training Duration
|
115 |
-
|
116 |
-
- **Total Training Time:** Approximately `2.40` minutes
|
117 |
-
### Logging and Monitoring
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
|
124 |
-
### Training Results
|
125 |
|
126 |
-
|
127 |
|
128 |
-
-
|
129 |
-
-
|
|
|
|
|
|
3 |
license: apache-2.0
|
4 |
base_model: distilbert-base-uncased
|
5 |
tags:
|
6 |
+
- generated_from_trainer
|
|
|
|
|
7 |
metrics:
|
8 |
+
- accuracy
|
9 |
+
model-index:
|
10 |
+
- name: emotion-classification-model
|
11 |
+
results: []
|
12 |
---
|
13 |
|
14 |
+
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
15 |
+
should probably proofread and complete it, then remove this comment. -->
|
16 |
+
|
17 |
# emotion-classification-model
|
18 |
|
19 |
+
This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on an unknown dataset.
|
20 |
It achieves the following results on the evaluation set:
|
21 |
+
- Loss: 0.1953
|
22 |
+
- Accuracy: 0.9225
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
## Model description
|
25 |
|
26 |
+
More information needed
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
## Intended uses & limitations
|
29 |
|
30 |
+
More information needed
|
31 |
|
32 |
+
## Training and evaluation data
|
33 |
|
34 |
+
More information needed
|
35 |
|
36 |
+
## Training procedure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
### Training hyperparameters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
The following hyperparameters were used during training:
|
41 |
+
- learning_rate: 6e-05
|
42 |
+
- train_batch_size: 16
|
43 |
+
- eval_batch_size: 32
|
44 |
+
- total_train_batch_size: 32
|
45 |
+
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
|
46 |
+
- lr_scheduler_type: linear
|
47 |
+
- num_epochs: 2
|
48 |
+
- mixed_precision_training: Native AMP
|
49 |
|
50 |
+
### Training results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|
53 |
+
|:-------------:|:-----:|:----:|:---------------:|:--------:|
|
54 |
+
| 0.2344 | 1.0 | 500 | 0.2365 | 0.915 |
|
55 |
+
| 0.1408 | 2.0 | 1000 | 0.1953 | 0.9225 |
|
56 |
|
|
|
57 |
|
58 |
+
### Framework versions
|
59 |
|
60 |
+
- Transformers 4.46.2
|
61 |
+
- Pytorch 2.5.1+cu118
|
62 |
+
- Datasets 3.1.0
|
63 |
+
- Tokenizers 0.20.3
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 267844872
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:27aacc44bdf0c1dab0cecec322b3ac730f3600530ca2c309e16a6f1080cd4020
|
3 |
size 267844872
|
training_args.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:037b20a108e5e1bbfc84287b9c78f6ee884f750423b982e7559a78a0b4e5e6e6
|
3 |
+
size 5304
|