Update README.md
Browse files
README.md
CHANGED
@@ -25,25 +25,18 @@ model-index:
|
|
25 |
# Text Classification GoEmotions
|
26 |
|
27 |
This a ONNX quantized model and is fined-tuned version of [nreimers/MiniLMv2-L6-H384-distilled-from-RoBERTa-Large](https://huggingface.co/nreimers/MiniLMv2-L6-H384-distilled-from-RoBERTa-Large) on the on the [go_emotions](https://huggingface.co/datasets/go_emotions) dataset using [tasinho/text-classification-goemotions](https://huggingface.co/tasinhoque/text-classification-goemotions) as teacher model.
|
|
|
28 |
|
29 |
# Usage
|
30 |
|
31 |
-
##
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
## No-transformers
|
38 |
-
|
39 |
-
### Installation
|
40 |
```bash
|
41 |
pip install tokenizers
|
42 |
pip install onnxruntime
|
43 |
git clone https://huggingface.co/minuva/MiniLMv2-goemotions-v2-onnx
|
44 |
```
|
45 |
|
46 |
-
|
47 |
|
48 |
```py
|
49 |
import os
|
@@ -64,7 +57,7 @@ tokenizer.enable_padding(
|
|
64 |
tokenizer.enable_truncation(max_length=256)
|
65 |
batch_size = 16
|
66 |
|
67 |
-
texts = ["I am angry",]
|
68 |
outputs = []
|
69 |
model = InferenceSession("MiniLMv2-goemotions-v2-onnx/model_optimized_quantized.onnx", providers=['CUDAExecutionProvider'])
|
70 |
|
@@ -112,7 +105,16 @@ for item in scores:
|
|
112 |
scores.append(float(s))
|
113 |
results.append({"labels": labels, "scores": scores})
|
114 |
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
```
|
117 |
# Training hyperparameters
|
118 |
|
|
|
25 |
# Text Classification GoEmotions
|
26 |
|
27 |
This a ONNX quantized model and is fined-tuned version of [nreimers/MiniLMv2-L6-H384-distilled-from-RoBERTa-Large](https://huggingface.co/nreimers/MiniLMv2-L6-H384-distilled-from-RoBERTa-Large) on the on the [go_emotions](https://huggingface.co/datasets/go_emotions) dataset using [tasinho/text-classification-goemotions](https://huggingface.co/tasinhoque/text-classification-goemotions) as teacher model.
|
28 |
+
The original model can be found [here](https://huggingface.co/minuva/MiniLMv2-goemotions-v2)
|
29 |
|
30 |
# Usage
|
31 |
|
32 |
+
## Installation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
```bash
|
34 |
pip install tokenizers
|
35 |
pip install onnxruntime
|
36 |
git clone https://huggingface.co/minuva/MiniLMv2-goemotions-v2-onnx
|
37 |
```
|
38 |
|
39 |
+
## Run the Model
|
40 |
|
41 |
```py
|
42 |
import os
|
|
|
57 |
tokenizer.enable_truncation(max_length=256)
|
58 |
batch_size = 16
|
59 |
|
60 |
+
texts = ["I am angry", "I feel in love"]
|
61 |
outputs = []
|
62 |
model = InferenceSession("MiniLMv2-goemotions-v2-onnx/model_optimized_quantized.onnx", providers=['CUDAExecutionProvider'])
|
63 |
|
|
|
105 |
scores.append(float(s))
|
106 |
results.append({"labels": labels, "scores": scores})
|
107 |
|
108 |
+
|
109 |
+
res = []
|
110 |
+
|
111 |
+
for result in results:
|
112 |
+
joined = list(zip(result['labels'], result['scores']))
|
113 |
+
max_score = max(joined, key=lambda x: x[1])
|
114 |
+
res.append(max_score)
|
115 |
+
|
116 |
+
res
|
117 |
+
# [('anger', 0.9745745062828064), ('love', 0.9884329438209534)]
|
118 |
```
|
119 |
# Training hyperparameters
|
120 |
|