From 4d567380665a8286e8ee7f22cd0001097b4ca5b5 Mon Sep 17 00:00:00 2001 From: iamWHTWD <28421344+iamWHTWD@users.noreply.github.com> Date: Wed, 8 Feb 2023 15:57:08 +0800 Subject: [PATCH] update ACT configs (#1653) * set onnx_format: True * set onnx_format: True * update qat_dis.yaml * update configs * Update prune_dis.yaml * Update qat_dis.yaml * Update README.md --- .../image_classification/README.md | 2 +- .../MobileNetV3_large_x1_0/qat_dis.yaml | 2 +- .../prune_dis.yaml | 36 +++++++++++++++++++ .../MobileNetV3_large_x1_0_ssld/qat_dis.yaml | 36 +++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/prune_dis.yaml create mode 100644 example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/qat_dis.yaml diff --git a/example/auto_compression/image_classification/README.md b/example/auto_compression/image_classification/README.md index 2e77242b..3917f141 100644 --- a/example/auto_compression/image_classification/README.md +++ b/example/auto_compression/image_classification/README.md @@ -44,7 +44,7 @@ | MobileNetV3_large_x1_0 | Baseline | 75.32 | - | 16.62 | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/MobileNetV3_large_x1_0_infer.tar) | | MobileNetV3_large_x1_0 | 量化+蒸馏 | 74.04 | - | 9.85 | [Config](./configs/MobileNetV3_large_x1_0/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/MobileNetV3_large_x1_0_QAT.tar) | | MobileNetV3_large_x1_0_ssld | Baseline | 78.96 | - | 16.62 | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/MobileNetV3_large_x1_0_ssld_infer.tar) | -| MobileNetV3_large_x1_0_ssld | 量化+蒸馏 | 77.17 | - | 9.85 | [Config](./configs/MobileNetV3_large_x1_0/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/MobileNetV3_large_x1_0_ssld_QAT.tar) | +| MobileNetV3_large_x1_0_ssld | 量化+蒸馏 | 77.17 | - | 9.85 | [Config](./configs/MobileNetV3_large_x1_0_ssld/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/MobileNetV3_large_x1_0_ssld_QAT.tar) | | ViT_base_patch16_224 | Baseline | 81.89 | 367.17(batch_size=40) | - | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/ViT_base_patch16_224_infer.tar) | | ViT_base_patch16_224 | 量化+蒸馏 | 82.05 | 51.70(batch_size=40) | - | [Config](./configs/VIT/qat_dis.yaml) | [Model](https://bj.bcebos.com/v1/paddle-slim-models/act/ViT_base_patch16_224_QAT.tar) | diff --git a/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml index 2da27da8..07a4dee6 100644 --- a/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml +++ b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0/qat_dis.yaml @@ -1,5 +1,5 @@ Global: - model_dir: MobileNetV3_large_x1_0_ssld_infer + model_dir: MobileNetV3_large_x1_0_infer model_filename: inference.pdmodel params_filename: inference.pdiparams batch_size: 128 diff --git a/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/prune_dis.yaml b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/prune_dis.yaml new file mode 100644 index 00000000..4a848a69 --- /dev/null +++ b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/prune_dis.yaml @@ -0,0 +1,36 @@ +Global: + model_dir: MobileNetV3_large_x1_0_ssld_infer + model_filename: inference.pdmodel + params_filename: inference.pdiparams + batch_size: 32 + data_dir: ./ILSVRC2012 + +Distillation: + alpha: 1.0 + loss: l2 + node: + - softmax_0.tmp_0 +UnstructurePrune: + prune_strategy: gmp + prune_mode: ratio + ratio: 0.75 + gmp_config: + stable_iterations: 0 + pruning_iterations: 4500 + tunning_iterations: 4500 + resume_iteration: -1 + pruning_steps: 100 + initial_ratio: 0.15 + prune_params_type: conv1x1_only + local_sparsity: True +TrainConfig: + epochs: 1 + eval_iter: 500 + learning_rate: + type: CosineAnnealingDecay + learning_rate: 0.015 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7532 diff --git a/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/qat_dis.yaml b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/qat_dis.yaml new file mode 100644 index 00000000..2da27da8 --- /dev/null +++ b/example/auto_compression/image_classification/configs/MobileNetV3_large_x1_0_ssld/qat_dis.yaml @@ -0,0 +1,36 @@ +Global: + model_dir: MobileNetV3_large_x1_0_ssld_infer + model_filename: inference.pdmodel + params_filename: inference.pdiparams + batch_size: 128 + data_dir: ./ILSVRC2012 + +Distillation: + alpha: 1.0 + loss: soft_label + +QuantAware: + use_pact: true + activation_bits: 8 + is_full_quantize: false + onnx_format: True + activation_quantize_type: moving_average_abs_max + weight_quantize_type: channel_wise_abs_max + not_quant_pattern: + - skip_quant + quantize_op_types: + - conv2d + - depthwise_conv2d + - matmul + - matmul_v2 + weight_bits: 8 + +TrainConfig: + epochs: 2 + eval_iter: 5000 + learning_rate: 0.001 + optimizer_builder: + optimizer: + type: Momentum + weight_decay: 0.00002 + origin_metric: 0.7896 -- GitLab