Update README.md
Browse files
README.md
CHANGED
|
@@ -11,7 +11,36 @@ This model identifies common events and patterns within the conversation flow. S
|
|
| 11 |
|
| 12 |
This model should be used *only* for agent dialogs.
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
## Installation
|
| 17 |
```bash
|
|
@@ -20,7 +49,6 @@ pip install onnxruntime
|
|
| 20 |
git clone https://huggingface.co/minuva/MiniLMv2-agentflow-v2-onnx
|
| 21 |
```
|
| 22 |
|
| 23 |
-
|
| 24 |
## Run the Model
|
| 25 |
|
| 26 |
```py
|
|
@@ -99,7 +127,8 @@ for result in results:
|
|
| 99 |
res.append(max_score)
|
| 100 |
|
| 101 |
res
|
| 102 |
-
# [('agent_apology_error_mistake', 0.
|
|
|
|
| 103 |
```
|
| 104 |
|
| 105 |
# Categories Explanation
|
|
|
|
| 11 |
|
| 12 |
This model should be used *only* for agent dialogs.
|
| 13 |
|
| 14 |
+
|
| 15 |
+
# Optimum
|
| 16 |
+
|
| 17 |
+
## Installation
|
| 18 |
+
|
| 19 |
+
Install from source:
|
| 20 |
+
```bash
|
| 21 |
+
python -m pip install optimum[onnxruntime]@git+https://github.com/huggingface/optimum.git
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
## Run the Model
|
| 26 |
+
```py
|
| 27 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
| 28 |
+
from transformers import AutoTokenizer, pipeline
|
| 29 |
+
|
| 30 |
+
model = ORTModelForSequenceClassification.from_pretrained('minuva/MiniLMv2-agentflow-v2-onnx', provider="CPUExecutionProvider")
|
| 31 |
+
tokenizer = AutoTokenizer.from_pretrained('minuva/MiniLMv2-agentflow-v2-onnx', use_fast=True, model_max_length=256, truncation=True, padding='max_length')
|
| 32 |
+
|
| 33 |
+
pipe = pipeline(task='text-classification', model=model, tokenizer=tokenizer, )
|
| 34 |
+
texts = ["My apologies", "Im not sure what you mean"]
|
| 35 |
+
pipe(texts)
|
| 36 |
+
# [{'label': 'agent_apology_error_mistake', 'score': 0.9967106580734253},
|
| 37 |
+
# {'label': 'agent_didnt_understand', 'score': 0.9975798726081848}]
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
# ONNX Runtime only
|
| 41 |
+
|
| 42 |
+
A lighter solution for deployment
|
| 43 |
+
|
| 44 |
|
| 45 |
## Installation
|
| 46 |
```bash
|
|
|
|
| 49 |
git clone https://huggingface.co/minuva/MiniLMv2-agentflow-v2-onnx
|
| 50 |
```
|
| 51 |
|
|
|
|
| 52 |
## Run the Model
|
| 53 |
|
| 54 |
```py
|
|
|
|
| 127 |
res.append(max_score)
|
| 128 |
|
| 129 |
res
|
| 130 |
+
# [('agent_apology_error_mistake', 0.9991968274116516),
|
| 131 |
+
# ('agent_didnt_understand', 0.9993669390678406)]
|
| 132 |
```
|
| 133 |
|
| 134 |
# Categories Explanation
|