upload int8 onnx model
Browse filesSigned-off-by: yuwenzho <[email protected]>
- README.md +27 -3
- model.onnx +3 -0
README.md
CHANGED
@@ -8,6 +8,7 @@ tags:
|
|
8 |
- Intel® Neural Compressor
|
9 |
- neural-compressor
|
10 |
- PostTrainingDynamic
|
|
|
11 |
datasets:
|
12 |
- glue
|
13 |
metrics:
|
@@ -29,7 +30,9 @@ model-index:
|
|
29 |
---
|
30 |
# INT8 camembert-base-mrpc
|
31 |
|
32 |
-
|
|
|
|
|
33 |
|
34 |
This is an INT8 PyTorch model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
|
35 |
|
@@ -37,14 +40,14 @@ The original fp32 model comes from the fine-tuned model [camembert-base-mrpc](ht
|
|
37 |
|
38 |
The linear module **roberta.encoder.layer.6.attention.self.query** falls back to fp32 to meet the 1% relative accuracy loss.
|
39 |
|
40 |
-
|
41 |
|
42 |
| |INT8|FP32|
|
43 |
|---|:---:|:---:|
|
44 |
| **Accuracy (eval-f1)** |0.8843|0.8928|
|
45 |
| **Model size (MB)** |180|422|
|
46 |
|
47 |
-
|
48 |
|
49 |
```python
|
50 |
from optimum.intel.neural_compressor import IncQuantizedModelForSequenceClassification
|
@@ -52,3 +55,24 @@ from optimum.intel.neural_compressor import IncQuantizedModelForSequenceClassifi
|
|
52 |
model_id = "Intel/camembert-base-mrpc-int8-dynamic"
|
53 |
int8_model = IncQuantizedModelForSequenceClassification.from_pretrained(model_id)
|
54 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- Intel® Neural Compressor
|
9 |
- neural-compressor
|
10 |
- PostTrainingDynamic
|
11 |
+
- onnx
|
12 |
datasets:
|
13 |
- glue
|
14 |
metrics:
|
|
|
30 |
---
|
31 |
# INT8 camembert-base-mrpc
|
32 |
|
33 |
+
## Post-training dynamic quantization
|
34 |
+
|
35 |
+
### PyTorch
|
36 |
|
37 |
This is an INT8 PyTorch model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
|
38 |
|
|
|
40 |
|
41 |
The linear module **roberta.encoder.layer.6.attention.self.query** falls back to fp32 to meet the 1% relative accuracy loss.
|
42 |
|
43 |
+
#### Test result
|
44 |
|
45 |
| |INT8|FP32|
|
46 |
|---|:---:|:---:|
|
47 |
| **Accuracy (eval-f1)** |0.8843|0.8928|
|
48 |
| **Model size (MB)** |180|422|
|
49 |
|
50 |
+
#### Load with Intel® Neural Compressor:
|
51 |
|
52 |
```python
|
53 |
from optimum.intel.neural_compressor import IncQuantizedModelForSequenceClassification
|
|
|
55 |
model_id = "Intel/camembert-base-mrpc-int8-dynamic"
|
56 |
int8_model = IncQuantizedModelForSequenceClassification.from_pretrained(model_id)
|
57 |
```
|
58 |
+
|
59 |
+
### ONNX
|
60 |
+
|
61 |
+
This is an INT8 ONNX model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
|
62 |
+
|
63 |
+
The original fp32 model comes from the fine-tuned model [camembert-base-mrpc](https://huggingface.co/Intel/camembert-base-mrpc).
|
64 |
+
|
65 |
+
#### Test result
|
66 |
+
|
67 |
+
| |INT8|FP32|
|
68 |
+
|---|:---:|:---:|
|
69 |
+
| **Accuracy (eval-f1)** |0.8847|0.8928|
|
70 |
+
| **Model size (MB)** |115|423|
|
71 |
+
|
72 |
+
|
73 |
+
#### Load ONNX model:
|
74 |
+
|
75 |
+
```python
|
76 |
+
from optimum.onnxruntime import ORTModelForSequenceClassification
|
77 |
+
model = ORTModelForSequenceClassification.from_pretrained('Intel/camembert-base-mrpc-int8-dynamic')
|
78 |
+
```
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e8f458d3d833494a31eb4d9ab863e1177e632f8e4ae0c7f45888c8f1cedb723f
|
3 |
+
size 120091323
|