未验证 提交 2fd40962 编写于 作者: Z zhouzj 提交者: GitHub

Update SMAC version requirements (#1684)

上级 e2b5c162
# 图像分类模型自动压缩示例 # 图像分类模型自动压缩示例
目录: 目录:
- [1. 简介](#1简介) - [图像分类模型自动压缩示例](#图像分类模型自动压缩示例)
- [2. Benchmark](#2Benchmark) - [1. 简介](#1-简介)
- [3. 自动压缩流程](#自动压缩流程) - [2. Benchmark](#2-benchmark)
- [3.1 准备环境](#31-准备准备) - [PaddleClas模型](#paddleclas模型)
- [3.2 准备数据集](#32-准备数据集) - [3. 自动压缩流程](#3-自动压缩流程)
- [3.3 准备预测模型](#33-准备预测模型) - [3.1 准备环境](#31-准备环境)
- [3.4 自动压缩并产出模型](#34-自动压缩并产出模型) - [3.2 准备数据集](#32-准备数据集)
- [4. 预测部署](#4预测部署) - [3.3 准备预测模型](#33-准备预测模型)
- [4.1 Python预测推理](#41-Python预测推理) - [3.4 自动压缩并产出模型](#34-自动压缩并产出模型)
- [4.2 PaddleLite端侧部署](#42-PaddleLite端侧部署) - [4.预测部署](#4预测部署)
- [5. FAQ](5FAQ) - [4.1 Paddle Inference 验证性能](#41-paddle-inference-验证性能)
- [4.2 PaddleLite端侧部署](#42-paddlelite端侧部署)
- [5.FAQ](#5faq)
## 1. 简介 ## 1. 简介
...@@ -34,7 +36,7 @@ ...@@ -34,7 +36,7 @@
| PPLCNetV2_base | Baseline | 76.86 | - | 36.50 | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPLCNetV2_base_infer.tar) | | PPLCNetV2_base | Baseline | 76.86 | - | 36.50 | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPLCNetV2_base_infer.tar) |
| PPLCNetV2_base | 量化+蒸馏 | 76.39 | - | 15.79 | [Config](./configs/PPLCNetV2_base/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/PPLCNetV2_base_QAT.tar) | | PPLCNetV2_base | 量化+蒸馏 | 76.39 | - | 15.79 | [Config](./configs/PPLCNetV2_base/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/PPLCNetV2_base_QAT.tar) |
| PPHGNet_tiny | Baseline | 79.59 | 2.82 | - | - |[Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPHGNet_tiny_infer.tar) | | PPHGNet_tiny | Baseline | 79.59 | 2.82 | - | - |[Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/PPHGNet_tiny_infer.tar) |
| PPHGNet_tiny | 量化+蒸馏 | 79.24 | 0.98 | - | [Config](./configs/PPHGNet_tiny/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/PPHGNet_tiny_QAT.tar) | | PPHGNet_tiny | 量化+蒸馏 | 78.86 | 0.98 | - | [Config](./configs/PPHGNet_tiny/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/PPHGNet_tiny_QAT.tar) |
| InceptionV3 | Baseline | 79.14 | 4.79 | - | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/InceptionV3_infer.tar) | | InceptionV3 | Baseline | 79.14 | 4.79 | - | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/InceptionV3_infer.tar) |
| InceptionV3 | 量化+蒸馏 | 78.32 | 1.47 | - | [Config](./configs/InceptionV3/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/InceptionV3_QAT.tar) | | InceptionV3 | 量化+蒸馏 | 78.32 | 1.47 | - | [Config](./configs/InceptionV3/qat_dis.yaml) | [Model](https://paddle-slim-models.bj.bcebos.com/act/InceptionV3_QAT.tar) |
| EfficientNetB0 | Baseline | 77.02 | 1.95 | - | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/EfficientNetB0_infer.tar) | | EfficientNetB0 | Baseline | 77.02 | 1.95 | - | - | [Model](https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/inference/EfficientNetB0_infer.tar) |
......
...@@ -7,9 +7,7 @@ Global: ...@@ -7,9 +7,7 @@ Global:
Distillation: Distillation:
alpha: 1.0 alpha: 1.0
loss: l2 loss: soft_label
node:
- softmax_1.tmp_0
QuantAware: QuantAware:
use_pact: true use_pact: true
...@@ -29,10 +27,10 @@ QuantAware: ...@@ -29,10 +27,10 @@ QuantAware:
TrainConfig: TrainConfig:
epochs: 1 epochs: 1
eval_iter: 500 eval_iter: 5000
learning_rate: learning_rate:
type: CosineAnnealingDecay type: CosineAnnealingDecay
learning_rate: 0.015 learning_rate: 0.001
optimizer_builder: optimizer_builder:
optimizer: optimizer:
type: Momentum type: Momentum
......
...@@ -19,7 +19,7 @@ QuantAware: ...@@ -19,7 +19,7 @@ QuantAware:
TrainConfig: TrainConfig:
epochs: 1 epochs: 1
eval_iter: 400 eval_iter: 400
learning_rate: 0.0005 learning_rate: 0.00005
optimizer_builder: optimizer_builder:
optimizer: optimizer:
type: SGD type: SGD
......
...@@ -104,7 +104,8 @@ class TableLatencyPredictor(LatencyPredictor): ...@@ -104,7 +104,8 @@ class TableLatencyPredictor(LatencyPredictor):
_logger.info("pip install paddleslim-opt-tools") _logger.info("pip install paddleslim-opt-tools")
out = shutil.which('paddle_lite_opt') out = shutil.which('paddle_lite_opt')
if out is None: if out is None:
pip.main(['install', 'paddleslim-opt-tools']) from pip._internal import main
main(['install', 'paddleslim-opt-tools'])
def _initial_table(self): def _initial_table(self):
if self.table_file in TableLatencyPredictor.hardware_list: if self.table_file in TableLatencyPredictor.hardware_list:
......
...@@ -415,9 +415,12 @@ def quant_post_hpo( ...@@ -415,9 +415,12 @@ def quant_post_hpo(
try: try:
import smac import smac
assert smac.version == '1.4.0'
except: except:
os.system('python -m pip install -U smac') _logger.warning(
# smac "smac==1.4.0 is required, please use \"pip install smac==1.4.0\".")
os.system('python -m pip install smac==1.4.0')
from ConfigSpace.hyperparameters import CategoricalHyperparameter, \ from ConfigSpace.hyperparameters import CategoricalHyperparameter, \
UniformFloatHyperparameter, UniformIntegerHyperparameter UniformFloatHyperparameter, UniformIntegerHyperparameter
from smac.configspace import ConfigurationSpace from smac.configspace import ConfigurationSpace
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册