Update README.md
Browse files
README.md
CHANGED
@@ -27,7 +27,34 @@ model-index:
|
|
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 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
## Installation
|
33 |
```bash
|
@@ -114,6 +141,7 @@ for result in results:
|
|
114 |
res.append(max_score)
|
115 |
|
116 |
res
|
|
|
117 |
# [('anger', 0.9745745062828064), ('love', 0.9884329438209534)]
|
118 |
```
|
119 |
# Training hyperparameters
|
|
|
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 |
+
# Optimum
|
31 |
+
|
32 |
+
## Installation
|
33 |
+
|
34 |
+
Install from source:
|
35 |
+
```bash
|
36 |
+
python -m pip install optimum[onnxruntime]@git+https://github.com/huggingface/optimum.git
|
37 |
+
```
|
38 |
+
|
39 |
+
|
40 |
+
## Run the Model
|
41 |
+
```py
|
42 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
43 |
+
from transformers import AutoTokenizer, pipeline
|
44 |
+
|
45 |
+
model = ORTModelForSequenceClassification.from_pretrained('minuva/MiniLMv2-goemotions-v2-onnx', provider="CPUExecutionProvider")
|
46 |
+
tokenizer = AutoTokenizer.from_pretrained('minuva/MiniLMv2-goemotions-v2-onnx', use_fast=True, model_max_length=256, truncation=True, padding='max_length')
|
47 |
+
|
48 |
+
pipe = pipeline(task='text-classification', model=model, tokenizer=tokenizer, )
|
49 |
+
texts = ["that's wrong", "can you please answer me?"]
|
50 |
+
pipe(texts)
|
51 |
+
# [{'label': 'anger', 'score': 0.9727636575698853},
|
52 |
+
# {'label': 'love', 'score': 0.9874765276908875}]
|
53 |
+
```
|
54 |
+
# ONNX Runtime only
|
55 |
+
|
56 |
+
A lighter solution for deployment
|
57 |
+
|
58 |
|
59 |
## Installation
|
60 |
```bash
|
|
|
141 |
res.append(max_score)
|
142 |
|
143 |
res
|
144 |
+
|
145 |
# [('anger', 0.9745745062828064), ('love', 0.9884329438209534)]
|
146 |
```
|
147 |
# Training hyperparameters
|