Update README.md
Browse files
README.md
CHANGED
@@ -28,23 +28,53 @@ It achieves the following results on the evaluation set:
|
|
28 |
|
29 |
## Model description
|
30 |
|
31 |
-
|
|
|
|
|
32 |
|
33 |
## Intended uses & limitations
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
## Training and evaluation data
|
38 |
|
39 |
-
|
|
|
|
|
40 |
|
41 |
## Training procedure
|
42 |
|
|
|
|
|
43 |
### Training hyperparameters
|
44 |
|
45 |
The following hyperparameters were used during training:
|
46 |
-
- optimizer:
|
47 |
-
-
|
|
|
|
|
48 |
|
49 |
### Training results
|
50 |
|
@@ -56,10 +86,22 @@ The following hyperparameters were used during training:
|
|
56 |
| 0.1465 | 0.9364 | 0.1838 | 0.9295 | 3 |
|
57 |
| 0.1168 | 0.9446 | 0.1709 | 0.9350 | 4 |
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
### Framework versions
|
61 |
|
62 |
- Transformers 4.26.1
|
63 |
- TensorFlow 2.11.0
|
64 |
- Datasets 2.9.0
|
65 |
-
- Tokenizers 0.13.2
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
## Model description
|
30 |
|
31 |
+
# MiniLM: Small and Fast Pre-trained Models for Language Understanding and Generation
|
32 |
+
|
33 |
+
MiniLM is a distilled model from the paper "MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers".
|
34 |
|
35 |
## Intended uses & limitations
|
36 |
|
37 |
+
This model has been created as a learning guide on:
|
38 |
+
- How to implement a text classification model using Hugging Face Transformers in TensorFlow
|
39 |
+
- How to handle imbalanced class distribution
|
40 |
+
|
41 |
+
# How to use the model
|
42 |
+
```
|
43 |
+
from transformers import pipeline
|
44 |
+
|
45 |
+
model_cpt = "laxsvips/minilm-finetuned-emotion"
|
46 |
+
pipe = pipeline("text-classification", model=model_cpt)
|
47 |
+
pipe("I am really excited about part 2 of the Hugging Face course")
|
48 |
+
predicted_scores = pipe("I am so glad you could help me")
|
49 |
+
print(predicted_scores)
|
50 |
+
````
|
51 |
+
The results:
|
52 |
+
```
|
53 |
+
[[{'label': 'sadness', 'score': 0.003758953418582678},
|
54 |
+
{'label': 'joy', 'score': 0.9874302744865417},
|
55 |
+
{'label': 'love', 'score': 0.00610917154699564},
|
56 |
+
{'label': 'anger', 'score': 9.696640336187556e-05},
|
57 |
+
{'label': 'fear', 'score': 0.0006420552381314337},
|
58 |
+
{'label': 'surprise', 'score': 0.00196251692250371}]]
|
59 |
+
```
|
60 |
|
61 |
## Training and evaluation data
|
62 |
|
63 |
+
[Emotion](https://huggingface.co/datasets/emotion)
|
64 |
+
|
65 |
+
Emotion is a dataset of English Twitter messages with six basic emotions: anger, fear, joy, love, sadness, and surprise.
|
66 |
|
67 |
## Training procedure
|
68 |
|
69 |
+
Refer to the [Colab](https://colab.research.google.com/github/laxmiharikumar/transformers/blob/main/TF_SimpleTrainingWithTransTrainers.ipynb) notebook
|
70 |
+
|
71 |
### Training hyperparameters
|
72 |
|
73 |
The following hyperparameters were used during training:
|
74 |
+
- optimizer: 'Adam',
|
75 |
+
- learning_rate': 5e-05,
|
76 |
+
- batch_size : 64
|
77 |
+
- num_epochs - 5
|
78 |
|
79 |
### Training results
|
80 |
|
|
|
86 |
| 0.1465 | 0.9364 | 0.1838 | 0.9295 | 3 |
|
87 |
| 0.1168 | 0.9446 | 0.1709 | 0.9350 | 4 |
|
88 |
|
89 |
+
### Evaluation Metrics
|
90 |
+
```
|
91 |
+
{'accuracy': 0.935,
|
92 |
+
'precision': 0.937365614416424,
|
93 |
+
'recall': 0.935,
|
94 |
+
'f1_score': 0.9355424419858925}
|
95 |
+
```
|
96 |
|
97 |
### Framework versions
|
98 |
|
99 |
- Transformers 4.26.1
|
100 |
- TensorFlow 2.11.0
|
101 |
- Datasets 2.9.0
|
102 |
+
- Tokenizers 0.13.2
|
103 |
+
|
104 |
+
### References
|
105 |
+
1. https://www.youtube.com/watch?v=u--UVvH-LIQ
|
106 |
+
2. https://huggingface.co/docs/transformers
|
107 |
+
3. https://www.tensorflow.org/api_docs/python/tf
|