echarlaix HF staff commited on
Commit
cdbf443
1 Parent(s): 096fd74

Add quantization and pruning config yaml files

Browse files
Files changed (2) hide show
  1. prune.yml +37 -0
  2. quantization.yml +33 -0
prune.yml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # Copyright (c) 2021 Intel Corporation
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ version: 1.0
17
+
18
+ model:
19
+ name: bert_prune
20
+ framework: pytorch
21
+
22
+ pruning:
23
+ approach:
24
+ weight_compression:
25
+ initial_sparsity: 0.0
26
+ target_sparsity: 0.1 # targeted sparsity of 10%
27
+ start_epoch: 0
28
+ end_epoch: 2
29
+ pruners:
30
+ - !Pruner
31
+ prune_type: basic_magnitude
32
+ tuning:
33
+ accuracy_criterion:
34
+ relative: 0.1 # only verifying workflow, accuracy loss percentage: 10%
35
+ exit_policy:
36
+ timeout: 0 # tuning timeout (seconds)
37
+ random_seed: 9527 # random seed
quantization.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # Copyright (c) 2021 Intel Corporation
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ version: 1.0
17
+
18
+ model: # mandatory.
19
+ name: bert
20
+ framework: pytorch # mandatory. possible values are pytorch and pytorch_fx.
21
+
22
+ device: cpu
23
+
24
+ quantization: # optional.
25
+ approach: post_training_dynamic_quant
26
+
27
+ tuning:
28
+ accuracy_criterion:
29
+ relative: 0.03 # optional. default value is relative, other value is absolute. this example allows relative accuracy loss: 3%.
30
+ exit_policy:
31
+ timeout: 0 # optional. tuning timeout (seconds). default value is 0 which means early stop. combine with max_trials field to decide when to exit.
32
+ max_trials: 30
33
+ random_seed: 9527 # optional. random seed for deterministic tuning.