Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
51538a94
P
PaddleSlim
项目概览
PaddlePaddle
/
PaddleSlim
接近 2 年 前同步成功
通知
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看板
未验证
提交
51538a94
编写于
11月 10, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
11月 10, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update full quant PTQ demo (#1512)
上级
e2f7e378
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
42 addition
and
25 deletion
+42
-25
example/full_quantization/picodet/configs/picodet_npu.yaml
example/full_quantization/picodet/configs/picodet_npu.yaml
+12
-4
example/full_quantization/picodet/configs/picodet_npu_with_postprocess.yaml
...ization/picodet/configs/picodet_npu_with_postprocess.yaml
+12
-4
example/full_quantization/picodet/post_quant.py
example/full_quantization/picodet/post_quant.py
+7
-6
example/full_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
...l_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
+3
-2
example/full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
.../full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
+7
-6
example/full_quantization/ppyoloe/post_quant.py
example/full_quantization/ppyoloe/post_quant.py
+1
-3
未找到文件。
example/full_quantization/picodet/configs/picodet_npu.yaml
浏览文件 @
51538a94
...
...
@@ -7,11 +7,15 @@ Global:
model_filename
:
model.pdmodel
params_filename
:
model.pdiparams
Distillation
:
alpha
:
1.0
loss
:
l2
PTQ
:
# Post Training Quantization
quantizable_op_type
:
[
"
conv2d"
,
"
depthwise_conv2d"
]
activation_quantize_type
:
'
moving_average_abs_max'
algo
:
avg
onnx_format
:
False
batch_size
:
32
batch_nums
:
10
Quantization
:
Quantization
:
# Auto Compression
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
...
...
@@ -20,6 +24,10 @@ Quantization:
-
conv2d
-
depthwise_conv2d
Distillation
:
alpha
:
1.0
loss
:
l2
TrainConfig
:
train_iter
:
8000
eval_iter
:
1000
...
...
example/full_quantization/picodet/configs/picodet_npu_with_postprocess.yaml
浏览文件 @
51538a94
...
...
@@ -7,11 +7,15 @@ Global:
model_filename
:
model.pdmodel
params_filename
:
model.pdiparams
Distillation
:
alpha
:
1.0
loss
:
l2
PTQ
:
# Post Training Quantization
quantizable_op_type
:
[
"
conv2d"
,
"
depthwise_conv2d"
]
activation_quantize_type
:
'
moving_average_abs_max'
algo
:
avg
onnx_format
:
False
batch_size
:
32
batch_nums
:
10
Quantization
:
Quantization
:
# Auto Compression
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
weight_bits
:
8
...
...
@@ -20,6 +24,10 @@ Quantization:
-
conv2d
-
depthwise_conv2d
Distillation
:
alpha
:
1.0
loss
:
l2
TrainConfig
:
train_iter
:
8000
eval_iter
:
1000
...
...
example/full_quantization/picodet/post_quant.py
浏览文件 @
51538a94
...
...
@@ -41,8 +41,6 @@ def argsparser():
type
=
str
,
default
=
'gpu'
,
help
=
"which device used to compress."
)
parser
.
add_argument
(
'--algo'
,
type
=
str
,
default
=
'avg'
,
help
=
"post quant algo."
)
return
parser
...
...
@@ -71,6 +69,7 @@ def main():
reader_cfg
[
'worker_num'
],
return_list
=
True
)
train_loader
=
reader_wrapper
(
train_loader
,
global_config
[
'input_list'
])
ptq_config
=
all_config
[
'PTQ'
]
place
=
paddle
.
CUDAPlace
(
0
)
if
FLAGS
.
devices
==
'gpu'
else
paddle
.
CPUPlace
()
exe
=
paddle
.
static
.
Executor
(
place
)
...
...
@@ -81,13 +80,15 @@ def main():
data_loader
=
train_loader
,
model_filename
=
global_config
[
"model_filename"
],
params_filename
=
global_config
[
"params_filename"
],
batch_size
=
32
,
batch_nums
=
10
,
algo
=
FLAGS
.
algo
,
quantizable_op_type
=
ptq_config
[
'quantizable_op_type'
],
activation_quantize_type
=
ptq_config
[
'activation_quantize_type'
],
batch_size
=
ptq_config
[
'batch_size'
],
batch_nums
=
ptq_config
[
'batch_nums'
],
algo
=
ptq_config
[
'algo'
],
hist_percent
=
0.999
,
is_full_quantize
=
False
,
bias_correction
=
False
,
onnx_format
=
True
,
onnx_format
=
ptq_config
[
'onnx_format'
]
,
skip_tensor_list
=
None
)
...
...
example/full_quantization/ppyoloe/configs/ppyoloe_s_416_qat_dis.yaml
浏览文件 @
51538a94
...
...
@@ -7,9 +7,10 @@ Global:
model_filename
:
model.pdmodel
params_filename
:
model.pdiparams
PTQ
:
PTQ
:
# Post Training Quantization
quantizable_op_type
:
[
"
conv2d"
,
"
depthwise_conv2d"
]
activation_quantize_type
:
'
moving_average_abs_max'
algo
:
avg
is_full_quantize
:
True
onnx_format
:
False
batch_size
:
10
...
...
@@ -19,7 +20,7 @@ Distillation:
alpha
:
1.0
loss
:
soft_label
Quantization
:
Quantization
:
# Auto Compression
onnx_format
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
...
...
example/full_quantization/ppyoloe/configs/ppyoloe_s_qat_dis.yaml
浏览文件 @
51538a94
...
...
@@ -7,19 +7,16 @@ Global:
model_filename
:
model.pdmodel
params_filename
:
model.pdiparams
PTQ
:
PTQ
:
# Post Training Quantization
quantizable_op_type
:
[
"
conv2d"
,
"
depthwise_conv2d"
]
activation_quantize_type
:
'
moving_average_abs_max'
algo
:
avg
is_full_quantize
:
True
onnx_format
:
False
batch_size
:
10
batch_nums
:
10
Distillation
:
alpha
:
1.0
loss
:
soft_label
Quantization
:
Quantization
:
# Auto Compression
onnx_format
:
true
use_pact
:
true
activation_quantize_type
:
'
moving_average_abs_max'
...
...
@@ -27,6 +24,10 @@ Quantization:
-
conv2d
-
depthwise_conv2d
Distillation
:
alpha
:
1.0
loss
:
soft_label
TrainConfig
:
train_iter
:
5000
eval_iter
:
1000
...
...
example/full_quantization/ppyoloe/post_quant.py
浏览文件 @
51538a94
...
...
@@ -42,8 +42,6 @@ def argsparser():
type
=
str
,
default
=
'gpu'
,
help
=
"which device used to compress."
)
parser
.
add_argument
(
'--algo'
,
type
=
str
,
default
=
'avg'
,
help
=
"post quant algo."
)
return
parser
...
...
@@ -89,7 +87,7 @@ def main():
activation_quantize_type
=
ptq_config
[
'activation_quantize_type'
],
batch_size
=
ptq_config
[
'batch_size'
],
batch_nums
=
ptq_config
[
'batch_nums'
],
algo
=
FLAGS
.
algo
,
algo
=
ptq_config
[
'algo'
]
,
hist_percent
=
0.999
,
is_full_quantize
=
ptq_config
[
'is_full_quantize'
],
bias_correction
=
False
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录