Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,60 @@
|
|
1 |
---
|
|
|
|
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
license: apache-2.0
|
5 |
+
tags:
|
6 |
+
- generated_from_trainer
|
7 |
+
datasets:
|
8 |
+
- glue
|
9 |
+
metrics:
|
10 |
+
- accuracy
|
11 |
+
model_index:
|
12 |
+
- name: sst2
|
13 |
+
results:
|
14 |
+
- task:
|
15 |
+
name: Text Classification
|
16 |
+
type: text-classification
|
17 |
+
dataset:
|
18 |
+
name: GLUE SST2
|
19 |
+
type: glue
|
20 |
+
args: sst2
|
21 |
+
metric:
|
22 |
+
name: Accuracy
|
23 |
+
type: accuracy
|
24 |
+
value: 0.9254587155963303
|
25 |
---
|
26 |
+
# INT8 albert-base-v2-sst2
|
27 |
+
|
28 |
+
### Post-training static quantization
|
29 |
+
|
30 |
+
This is an INT8 PyTorch model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
|
31 |
+
|
32 |
+
The original fp32 model comes from the fine-tuned model [Alireza1044/albert-base-v2-sst2](https://huggingface.co/Alireza1044/albert-base-v2-sst2).
|
33 |
+
|
34 |
+
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.
|
35 |
+
|
36 |
+
The linear modules **albert.encoder.albert_layer_groups.0.albert_layers.0.ffn_output.module, albert.encoder.albert_layer_groups.0.albert_layers.0.ffn.module** fall back to fp32 to meet the 1% relative accuracy loss.
|
37 |
+
|
38 |
+
### Test result
|
39 |
+
|
40 |
+
- Batch size = 8
|
41 |
+
- [Amazon Web Services](https://aws.amazon.com/) c6i.xlarge (Intel ICE Lake: 4 vCPUs, 8g Memory) instance.
|
42 |
+
|
43 |
+
| |INT8|FP32|
|
44 |
+
|---|:---:|:---:|
|
45 |
+
| **Throughput (samples/sec)** |13.464|11.854|
|
46 |
+
| **Accuracy (eval-accuracy)** |0.9255|0.9232|
|
47 |
+
| **Model size (MB)** |25|44.6|
|
48 |
+
|
49 |
+
### Load with Intel® Neural Compressor (build from source):
|
50 |
+
|
51 |
+
```python
|
52 |
+
from neural_compressor.utils.load_huggingface import OptimizedModel
|
53 |
+
int8_model = OptimizedModel.from_pretrained(
|
54 |
+
'Intel/albert-base-v2-sst2-int8-static',
|
55 |
+
)
|
56 |
+
```
|
57 |
+
|
58 |
+
Notes:
|
59 |
+
- 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.
|
60 |
+
|