bhadresh-savani
commited on
Commit
•
b1f9416
1
Parent(s):
668f3dc
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
thumbnail: https://avatars3.githubusercontent.com/u/32437151?s=460&u=4ec59abc8d21d5feea3dab323d23a5860e6996a4&v=4
|
5 |
+
tags:
|
6 |
+
- text-classification
|
7 |
+
- emotion
|
8 |
+
- pytorch
|
9 |
+
license: apache-2.0
|
10 |
+
datasets:
|
11 |
+
- emotion
|
12 |
+
metrics:
|
13 |
+
- Accuracy, F1 Score
|
14 |
+
---
|
15 |
+
# Albert-base-v2-emotion
|
16 |
+
|
17 |
+
## Model description:
|
18 |
+
[Albert](https://arxiv.org/pdf/1909.11942v6.pdf) is A Lite BERT architecture that has significantly fewer parameters than a traditional BERT architecture.
|
19 |
+
|
20 |
+
`Albert-base-v2` finetuned on the emotion dataset using HuggingFace Trainer with below Hyperparameters
|
21 |
+
```
|
22 |
+
learning rate 2e-5,
|
23 |
+
batch size 64,
|
24 |
+
num_train_epochs=8,
|
25 |
+
```
|
26 |
+
|
27 |
+
## Model Performance Comparision on Emotion Dataset from Twitter:
|
28 |
+
|
29 |
+
| Model | Accuracy | F1 Score | Test Sample per Second |
|
30 |
+
| --- | --- | --- | --- |
|
31 |
+
| [Distilbert-base-uncased-emotion](https://huggingface.co/bhadresh-savani/distilbert-base-uncased-emotion) | 93.8 | 93.79 | 398.69 |
|
32 |
+
| [Bert-base-uncased-emotion](https://huggingface.co/bhadresh-savani/bert-base-uncased-emotion) | 94.05 | 94.06 | 190.152 |
|
33 |
+
| [Roberta-base-emotion](https://huggingface.co/bhadresh-savani/roberta-base-emotion) | 93.95 | 93.97| 195.639 |
|
34 |
+
| [Albert-base-v2-emotion](https://huggingface.co/bhadresh-savani/albert-base-v2-emotion) | 93.6 | 93.65 | 182.794 |
|
35 |
+
|
36 |
+
## How to Use the model:
|
37 |
+
```python
|
38 |
+
from transformers import pipeline
|
39 |
+
classifier = pipeline("text-classification",model='bhadresh-savani/albert-base-v2-emotion', return_all_scores=True)
|
40 |
+
prediction = classifier("I love using transformers. The best part is wide range of support and its easy to use", )
|
41 |
+
print(prediction)
|
42 |
+
|
43 |
+
"""
|
44 |
+
Output:
|
45 |
+
[[
|
46 |
+
{'label': 'sadness', 'score': 0.0006792712374590337},
|
47 |
+
{'label': 'joy', 'score': 0.9959300756454468},
|
48 |
+
{'label': 'love', 'score': 0.0009452480007894337},
|
49 |
+
{'label': 'anger', 'score': 0.0018055217806249857},
|
50 |
+
{'label': 'fear', 'score': 0.00041110432357527316},
|
51 |
+
{'label': 'surprise', 'score': 0.0002288572577526793}
|
52 |
+
]]
|
53 |
+
"""
|
54 |
+
```
|
55 |
+
|
56 |
+
## Dataset:
|
57 |
+
[Twitter-Sentiment-Analysis](https://huggingface.co/nlp/viewer/?dataset=emotion).
|
58 |
+
|
59 |
+
## Training procedure
|
60 |
+
[Colab Notebook](https://github.com/bhadreshpsavani/ExploringSentimentalAnalysis/blob/main/SentimentalAnalysisWithDistilbert.ipynb)
|
61 |
+
|
62 |
+
## Eval results
|
63 |
+
```json
|
64 |
+
{'test_accuracy': 0.936,
|
65 |
+
'test_f1': 0.9365658988006296,
|
66 |
+
'test_loss': 0.15278364717960358,
|
67 |
+
'test_runtime': 10.9413,
|
68 |
+
'test_samples_per_second': 182.794,
|
69 |
+
'test_steps_per_second': 2.925}
|
70 |
+
```
|
71 |
+
|
72 |
+
## Reference:
|
73 |
+
* [Natural Language Processing with Transformer By Lewis Tunstall, Leandro von Werra, Thomas Wolf](https://learning.oreilly.com/library/view/natural-language-processing/9781098103231/)
|