Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
3cf61169
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
大约 1 年 前同步成功
通知
51
Star
1434
Fork
344
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
16
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSlim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
16
合并请求
16
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
3cf61169
编写于
4月 08, 2022
作者:
C
ceci3
提交者:
GitHub
4月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix auto-compression demo (#1035)
* fix * fix ac demo
上级
83869609
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
11 deletion
+17
-11
demo/auto-compression/README.md
demo/auto-compression/README.md
+2
-2
demo/auto-compression/configs/CV/mbv2_qat_dis.yaml
demo/auto-compression/configs/CV/mbv2_qat_dis.yaml
+1
-1
demo/auto-compression/configs/NLP/bert_asp_dis.yaml
demo/auto-compression/configs/NLP/bert_asp_dis.yaml
+1
-1
demo/auto-compression/run_gelu.sh
demo/auto-compression/run_gelu.sh
+5
-3
demo/auto-compression/run_imagenet.sh
demo/auto-compression/run_imagenet.sh
+5
-4
demo/quant/quant_post/eval.py
demo/quant/quant_post/eval.py
+2
-0
paddleslim/auto_compression/compressor.py
paddleslim/auto_compression/compressor.py
+1
-0
未找到文件。
demo/auto-compression/README.md
浏览文件 @
3cf61169
...
...
@@ -54,9 +54,9 @@ python tools/export_model.py \
```
cd PaddleSlim/demo/auto-compression/
```
使用
[
eval.py
](
../quant_post/eval.py
)
脚本得到模型的分类精度:
使用
[
eval.py
](
../quant
/quant
_post/eval.py
)
脚本得到模型的分类精度:
```
python ../quant_post/eval.py --model_path infermodel_mobilenetv2 --model_name inference.pdmodel --params_name inference.pdiparams
python ../quant
/quant
_post/eval.py --model_path infermodel_mobilenetv2 --model_name inference.pdmodel --params_name inference.pdiparams
```
精度输出为:
```
...
...
demo/auto-compression/configs/CV/mbv2_qat_dis.yaml
浏览文件 @
3cf61169
...
...
@@ -41,7 +41,7 @@ Distillation:
-
teacher_linear_1.tmp_0
-
linear_1.tmp_0
merge_feed
:
true
teacher_model_dir
:
./
MobileNetV2_ssld_infer
teacher_model_dir
:
./
infermodel_mobilenetv2
teacher_model_filename
:
inference.pdmodel
teacher_params_filename
:
inference.pdiparams
Quantization
:
...
...
demo/auto-compression/configs/NLP/bert_asp_dis.yaml
浏览文件 @
3cf61169
...
...
@@ -29,7 +29,7 @@ Distillation:
-
teacher_linear_147.tmp_1
-
linear_147.tmp_1
merge_feed
:
true
teacher_model_dir
:
../auto-compression_origin/
static_bert_models
teacher_model_dir
:
static_bert_models
teacher_model_filename
:
bert.pdmodel
teacher_params_filename
:
bert.pdiparams
Prune
:
...
...
demo/auto-compression/run_gelu.sh
浏览文件 @
3cf61169
python3.7 demo_glue.py
--config_path
./configs/NLP/bert_qat_dis.yaml
--task
'sst-2'
\
--model_dir
=
'.
./auto-compression_origin
/static_bert_models/'
\
python3.7 demo_glue.py
\
--model_dir
=
'./static_bert_models/'
\
--model_filename
=
'bert.pdmodel'
\
--params_filename
=
'bert.pdiparams'
\
--save_dir
=
'./save_asp_bert/'
\
--devices
=
'
g
pu'
\
--devices
=
'
c
pu'
\
--batch_size
=
32
\
--task
=
'sst-2'
\
--config_path
=
'./configs/NLP/bert_asp_dis.yaml'
demo/auto-compression/run_imagenet.sh
浏览文件 @
3cf61169
python3.7 demo_imagenet.py
--config_path
./configs/CV/mbv2_ptq_hpo.yaml
\
--model_dir
=
'
../auto-compression_origin/MobileNetV2_ssld_infer/
'
\
python3.7 demo_imagenet.py
\
--model_dir
=
'
infermodel_mobilenetv2
'
\
--model_filename
=
'inference.pdmodel'
\
--params_filename
=
'./inference.pdiparams'
\
--save_dir
=
'./save_qat_mbv2/'
\
--devices
=
'gpu'
\
--batch_size
=
64
\
--devices
=
'cpu'
\
--batch_size
=
2
\
--config_path
=
'./configs/CV/mbv2_ptq_hpo.yaml'
demo/quant/quant_post/eval.py
浏览文件 @
3cf61169
...
...
@@ -21,6 +21,8 @@ import functools
import
paddle
sys
.
path
[
0
]
=
os
.
path
.
join
(
os
.
path
.
dirname
(
"__file__"
),
os
.
path
.
pardir
,
os
.
path
.
pardir
)
sys
.
path
[
1
]
=
os
.
path
.
join
(
os
.
path
.
dirname
(
"__file__"
),
os
.
path
.
pardir
)
import
imagenet_reader
as
reader
from
utility
import
add_arguments
,
print_arguments
...
...
paddleslim/auto_compression/compressor.py
浏览文件 @
3cf61169
...
...
@@ -276,6 +276,7 @@ class AutoCompression:
### used to check whether the dataloader is right
if
self
.
eval_function
is
not
None
and
self
.
train_config
.
origin_metric
is
not
None
:
_logger
.
info
(
"start to test metric before compress"
)
metric
=
self
.
eval_function
(
self
.
_exe
,
inference_program
,
feed_target_names
,
fetch_targets
)
_logger
.
info
(
"metric of compressed model is: {}"
.
format
(
metric
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录