Skip to content

Commit

Permalink
[Feature]Add paddleslim ACT. (#3457)
Browse files Browse the repository at this point in the history
* compat_slim

* add_ppliteseg_act
  • Loading branch information
shiyutang authored Aug 28, 2023
1 parent 418ac1b commit 88cbff8
Show file tree
Hide file tree
Showing 11 changed files with 988 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/PaddlePaddle/mirrors-yapf.git
sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
rev: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
hooks:
- id: yapf
files: \.py$
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: a11d9314b22d8f8c7556443875b731ef05965464
rev: a11d9314b22d8f8c7556443875b731ef05965464
hooks:
- id: check-merge-conflict
- id: check-symlinks
Expand All @@ -16,7 +16,7 @@ repos:
- id: trailing-whitespace
files: \.md$
- repo: https://github.com/Lucas-C/pre-commit-hooks
sha: v1.0.1
rev: v1.0.1
hooks:
- id: forbid-crlf
files: \.md$
Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
* [量化](./docs/deployment/slim/quant/quant_cn.md)
* [蒸馏](./docs/deployment/slim/distill/distill_cn.md)
* [裁剪](./docs/deployment/slim/prune/prune_cn.md)
* [自动压缩](./docs/deployment/slim/act/readme.md)

* [常见问题汇总](./docs/faq/faq/faq_cn.md)

Expand Down
1 change: 1 addition & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ Note that:
* [Quantization](./docs/deployment/slim/quant/quant.md)
* [Distillation](./docs/deployment/slim/distill/distill.md)
* [Pruning](./docs/deployment/slim/prune/prune.md)
* [Auto Compression](./docs/deployment/slim/act/readme.md)

* [FAQ](./docs/faq/faq/faq.md)

Expand Down
26 changes: 26 additions & 0 deletions deploy/slim/act/configs/ppliteseg/ppliteseg_ptq.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Global:
model_dir: ./liteseg_tiny_scale1.0
model_filename: model.pdmodel
params_filename: model.pdiparams

QuantPost:
batch_size: 32
batch_nums: 50 # can't be none
algo: 'mse'
hist_percent: 0.999
recon_level: None
regions: None
bias_correction: False # it is correction
epochs: 20
lr: 0.1
simulate_activation_quant: False
skip_tensor_list: None

TrainConfig:
epochs: 20
eval_iter: 180
learning_rate: 0.0005
optimizer_builder:
optimizer:
type: SGD
weight_decay: 4.0e-05
26 changes: 26 additions & 0 deletions deploy/slim/act/configs/ppliteseg/ppliteseg_qat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Global:
model_dir: ./liteseg_tiny_scale1.0
model_filename: model.pdmodel
params_filename: model.pdiparams

Distillation:
alpha: 1.0
loss: l2
node:
- conv2d_94.tmp_0 # change to the name of the output of the last conv in the model.pdmodel in netron

QuantAware:
onnx_format: True
quantize_op_types:
- conv2d
- depthwise_conv2d

TrainConfig:
epochs: 20
eval_iter: 180
learning_rate: 0.0005
optimizer_builder:
optimizer:
type: SGD
weight_decay: 4.0e-05

Loading

0 comments on commit 88cbff8

Please sign in to comment.