Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1 |
---
|
|
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
license: apache-2.0
|
4 |
+
tags:
|
5 |
+
- text-classfication
|
6 |
+
- int8
|
7 |
+
- PostTrainingStatic
|
8 |
+
datasets:
|
9 |
+
- mrpc
|
10 |
+
metrics:
|
11 |
+
- f1
|
12 |
---
|
13 |
+
|
14 |
+
# INT8 BERT base uncased finetuned MRPC
|
15 |
+
|
16 |
+
### Post-training static quantization
|
17 |
+
|
18 |
+
This is an INT8 PyTorch model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
|
19 |
+
|
20 |
+
The original fp32 model comes from the fine-tuned model [Intel/bert-base-uncased-mrpc](https://huggingface.co/Intel/bert-base-uncased-mrpc).
|
21 |
+
|
22 |
+
The calibration dataloader is the train dataloader. The default calibration sampling size 300 isn't divisible exactly by batch size 8, so the real sampling size is 304.
|
23 |
+
|
24 |
+
The linear module **bert.encoder.layer.9.output.dense, bert.encoder.layer.10.output.dense** falls back to fp32 to meet the 1% relative accuracy loss.
|
25 |
+
|
26 |
+
### Test result
|
27 |
+
|
28 |
+
- Batch size = 8
|
29 |
+
- [Amazon Web Services](https://aws.amazon.com/) c6i.xlarge (Intel ICE Lake: 4 vCPUs, 8g Memory) instance.
|
30 |
+
|
31 |
+
| |INT8|FP32|
|
32 |
+
|---|:---:|:---:|
|
33 |
+
| **Throughput (samples/sec)** |23.986|11.202|
|
34 |
+
| **Accuracy (eval-f1)** |0.8997|0.9042|
|
35 |
+
| **Model size (MB)** |120|418|
|
36 |
+
|
37 |
+
### Load with Intel® Neural Compressor (build from source):
|
38 |
+
|
39 |
+
```python
|
40 |
+
from neural_compressor.utils.load_huggingface import OptimizedModel
|
41 |
+
int8_model = OptimizedModel.from_pretrained(
|
42 |
+
'Intel/bert-base-uncased-mrpc-int8-static',
|
43 |
+
)
|
44 |
+
```
|
45 |
+
|
46 |
+
Notes:
|
47 |
+
- The INT8 model has better performance than the FP32 model when the CPU is fully occupied. Otherwise, there will be the illusion that INT8 is inferior to FP32.
|