diff --git a/PaddleSlim/configs/auto_prune.yaml b/PaddleSlim/configs/auto_prune.yaml new file mode 100644 index 0000000000000000000000000000000000000000..51a8e2f887b1b96114ea810795ef9288d8b15b01 --- /dev/null +++ b/PaddleSlim/configs/auto_prune.yaml @@ -0,0 +1,32 @@ +version: 1.0 +pruners: + pruner_1: + class: 'StructurePruner' + pruning_axis: + '*': 0 + criterions: + '*': 'l1_norm' +controllers: + sa_controller: + class: 'SAController' + reduce_rate: 0.9 + init_temperature: 100 + max_iter_number: 300 +strategies: + auto_pruning_strategy: + class: 'AutoPruneStrategy' + pruner: 'pruner_1' + controller: 'sa_controller' + start_epoch: 0 + end_epoch: 500 + retrain_epoch: 0 + max_ratio: 0.50 + min_ratio: 0.48 + uniform_range: 0.4 + pruned_params: '.*_sep_weights' + metric_name: 'acc_top1' +compressor: + epoch: 500 + checkpoint_path: './checkpoints_auto_pruning/' + strategies: + - auto_pruning_strategy diff --git a/PaddleSlim/run.sh b/PaddleSlim/run.sh index 791b42da93d9ffaeb2610cb3fca0e3430e1bf17a..23d7498f23b20d9c502baa162e446a923b9fe341 100644 --- a/PaddleSlim/run.sh +++ b/PaddleSlim/run.sh @@ -67,6 +67,14 @@ cd - #--pretrained_model ./pretrain/MobileNetV1_pretrained \ #--compress_config ./configs/filter_pruning_uniform.yaml +# for auto filter pruning +#--------------------------- +#export CUDA_VISIBLE_DEVICES=0 +#python compress.py \ +#--model "MobileNet" \ +#--pretrained_model ./pretrain/MobileNetV1_pretrained \ +#--compress_config ./configs/auto_prune.yaml + # for quantization #----------------- #export CUDA_VISIBLE_DEVICES=0