Update README.md
Browse files
README.md
CHANGED
@@ -9,7 +9,34 @@ This is a quantized onnx model and is a fined-tuned version of [nreimers/MiniLMv
|
|
9 |
The original model can be found [here](https://huggingface.co/minuva/MiniLMv2-toxic-jigsaw)
|
10 |
|
11 |
|
12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
## Installation
|
15 |
|
|
|
9 |
The original model can be found [here](https://huggingface.co/minuva/MiniLMv2-toxic-jigsaw)
|
10 |
|
11 |
|
12 |
+
# Optimum
|
13 |
+
|
14 |
+
## Installation
|
15 |
+
|
16 |
+
Install from source:
|
17 |
+
```bash
|
18 |
+
python -m pip install optimum[onnxruntime]@git+https://github.com/huggingface/optimum.git
|
19 |
+
```
|
20 |
+
|
21 |
+
|
22 |
+
## Run the Model
|
23 |
+
```py
|
24 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
25 |
+
from transformers import AutoTokenizer, pipeline
|
26 |
+
|
27 |
+
model = ORTModelForSequenceClassification.from_pretrained('minuva/MiniLMv2-toxic-jigsaw-onnx', provider="CPUExecutionProvider")
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained('minuva/MiniLMv2-toxic-jigsaw-onnx', use_fast=True, model_max_length=256, truncation=True, padding='max_length')
|
29 |
+
|
30 |
+
pipe = pipeline(task='text-classification', model=model, tokenizer=tokenizer, )
|
31 |
+
texts = ["This is pure trash",]
|
32 |
+
pipe(texts)
|
33 |
+
# [{'label': 'toxic', 'score': 0.736885666847229}]
|
34 |
+
```
|
35 |
+
|
36 |
+
# ONNX Runtime only
|
37 |
+
|
38 |
+
A lighter solution for deployment
|
39 |
+
|
40 |
|
41 |
## Installation
|
42 |
|