yuwenz commited on
Commit
61d17e5
1 Parent(s): 51e8be3

upload int8 onnx model

Browse files

Signed-off-by: yuwenzho <yuwen.zhou@intel.com>

Files changed (4) hide show
  1. README.md +37 -0
  2. config.json +43 -0
  3. model.onnx +3 -0
  4. tokenizer.json +0 -0
README.md CHANGED
@@ -1,3 +1,40 @@
1
  ---
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: en
3
  license: apache-2.0
4
+ tags:
5
+ - text-classfication
6
+ - int8
7
+ - Intel® Neural Compressor
8
+ - PostTrainingDynamic
9
+ - onnx
10
+ datasets:
11
+ - mrpc
12
+ metrics:
13
+ - f1
14
  ---
15
+
16
+ # INT8 albert-base-v2-sst2
17
+
18
+ ## Post-training dynamic quantization
19
+
20
+ ### ONNX
21
+
22
+ This is an INT8 ONNX model quantized with [Intel® Neural Compressor](https://github.com/intel/neural-compressor).
23
+
24
+ The original fp32 model comes from the fine-tuned model [Alireza1044/albert-base-v2-sst2](https://huggingface.co/Alireza1044/albert-base-v2-sst2).
25
+
26
+ #### Test result
27
+
28
+ | |INT8|FP32|
29
+ |---|:---:|:---:|
30
+ | **Accuracy (eval-f1)** |0.9140|0.9232|
31
+ | **Model size (MB)** |57|45|
32
+
33
+
34
+ #### Load ONNX model:
35
+
36
+ ```python
37
+ from optimum.onnxruntime import ORTModelForSequenceClassification
38
+ model = ORTModelForSequenceClassification.from_pretrained('Intel/albert-base-v2-sst2-int8-dynamic')
39
+ ```
40
+
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "Alireza1044/albert-base-v2-sst2",
3
+ "architectures": [
4
+ "AlbertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0,
7
+ "bos_token_id": 2,
8
+ "classifier_dropout_prob": 0.1,
9
+ "down_scale_factor": 1,
10
+ "embedding_size": 128,
11
+ "eos_token_id": 3,
12
+ "finetuning_task": "sst2",
13
+ "gap_size": 0,
14
+ "hidden_act": "gelu_new",
15
+ "hidden_dropout_prob": 0,
16
+ "hidden_size": 768,
17
+ "initializer_range": 0.02,
18
+ "inner_group_num": 1,
19
+ "intermediate_size": 3072,
20
+ "layer_norm_eps": 1e-12,
21
+ "max_position_embeddings": 512,
22
+ "model_type": "albert",
23
+ "net_structure_type": 0,
24
+ "num_attention_heads": 12,
25
+ "num_hidden_groups": 1,
26
+ "num_hidden_layers": 12,
27
+ "num_memory_blocks": 0,
28
+ "pad_token_id": 0,
29
+ "position_embedding_type": "absolute",
30
+ "problem_type": "single_label_classification",
31
+ "torch_dtype": "int8",
32
+ "transformers_version": "4.18.0",
33
+ "type_vocab_size": 2,
34
+ "vocab_size": 30000,
35
+ "label2id": {
36
+ "negative": 0,
37
+ "positive": 1
38
+ },
39
+ "id2label": {
40
+ "0": "negative",
41
+ "1": "positive"
42
+ }
43
+ }
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adf3f4b46f838e0c1888ffe314e7d0c82694b2fb9637d93ffdc86adcc721acf2
3
+ size 59583642
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff