Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
d31a202a
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看板
未验证
提交
d31a202a
编写于
3月 29, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
3月 29, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add adaround post quant method (#1023)
上级
d2ecc862
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
7 addition
and
0 deletion
+7
-0
demo/quant/quant_post/quant_post.py
demo/quant/quant_post/quant_post.py
+2
-0
paddleslim/quant/quanter.py
paddleslim/quant/quanter.py
+5
-0
未找到文件。
demo/quant/quant_post/quant_post.py
浏览文件 @
d31a202a
...
@@ -29,6 +29,7 @@ add_arg('save_path', str, "./quant_model/MobileNet/", "model dir to save
...
@@ -29,6 +29,7 @@ add_arg('save_path', str, "./quant_model/MobileNet/", "model dir to save
add_arg
(
'model_filename'
,
str
,
None
,
"model file name"
)
add_arg
(
'model_filename'
,
str
,
None
,
"model file name"
)
add_arg
(
'params_filename'
,
str
,
None
,
"params file name"
)
add_arg
(
'params_filename'
,
str
,
None
,
"params file name"
)
add_arg
(
'algo'
,
str
,
'hist'
,
"calibration algorithm"
)
add_arg
(
'algo'
,
str
,
'hist'
,
"calibration algorithm"
)
add_arg
(
'round_type'
,
str
,
'round'
,
"The method of converting the quantized weights."
)
add_arg
(
'hist_percent'
,
float
,
0.9999
,
"The percentile of algo:hist"
)
add_arg
(
'hist_percent'
,
float
,
0.9999
,
"The percentile of algo:hist"
)
add_arg
(
'bias_correction'
,
bool
,
False
,
"Whether to use bias correction"
)
add_arg
(
'bias_correction'
,
bool
,
False
,
"Whether to use bias correction"
)
add_arg
(
'ce_test'
,
bool
,
False
,
"Whether to CE test."
)
add_arg
(
'ce_test'
,
bool
,
False
,
"Whether to CE test."
)
...
@@ -74,6 +75,7 @@ def quantize(args):
...
@@ -74,6 +75,7 @@ def quantize(args):
batch_size
=
args
.
batch_size
,
batch_size
=
args
.
batch_size
,
batch_nums
=
args
.
batch_num
,
batch_nums
=
args
.
batch_num
,
algo
=
args
.
algo
,
algo
=
args
.
algo
,
round_type
=
args
.
round_type
,
hist_percent
=
args
.
hist_percent
,
hist_percent
=
args
.
hist_percent
,
bias_correction
=
args
.
bias_correction
)
bias_correction
=
args
.
bias_correction
)
...
...
paddleslim/quant/quanter.py
浏览文件 @
d31a202a
...
@@ -325,6 +325,7 @@ def quant_post_static(
...
@@ -325,6 +325,7 @@ def quant_post_static(
batch_nums
=
None
,
batch_nums
=
None
,
scope
=
None
,
scope
=
None
,
algo
=
'hist'
,
algo
=
'hist'
,
round_type
=
'round'
,
hist_percent
=
0.9999
,
hist_percent
=
0.9999
,
bias_correction
=
False
,
bias_correction
=
False
,
quantizable_op_type
=
[
"conv2d"
,
"depthwise_conv2d"
,
"mul"
],
quantizable_op_type
=
[
"conv2d"
,
"depthwise_conv2d"
,
"mul"
],
...
@@ -380,6 +381,9 @@ def quant_post_static(
...
@@ -380,6 +381,9 @@ def quant_post_static(
makes the mse loss minimal. Use one batch of data for mse is enough. If
makes the mse loss minimal. Use one batch of data for mse is enough. If
algo='avg', use the average of abs_max values to get the scale factor. If
algo='avg', use the average of abs_max values to get the scale factor. If
algo='abs_max', use abs_max method to get the scale factor. Default: 'hist'.
algo='abs_max', use abs_max method to get the scale factor. Default: 'hist'.
round_type(str, optional): The method of converting the quantized weights value
from float to int. Currently supports ['round', 'adaround'] methods.
Default is `round`, which is rounding nearest to the nearest whole number.
hist_percent(float, optional): The percentile of histogram for algo hist.Default:0.9999.
hist_percent(float, optional): The percentile of histogram for algo hist.Default:0.9999.
bias_correction(bool, optional): Bias correction method of https://arxiv.org/abs/1810.05723.
bias_correction(bool, optional): Bias correction method of https://arxiv.org/abs/1810.05723.
Default: False.
Default: False.
...
@@ -420,6 +424,7 @@ def quant_post_static(
...
@@ -420,6 +424,7 @@ def quant_post_static(
batch_nums
=
batch_nums
,
batch_nums
=
batch_nums
,
scope
=
scope
,
scope
=
scope
,
algo
=
algo
,
algo
=
algo
,
round_type
=
round_type
,
hist_percent
=
hist_percent
,
hist_percent
=
hist_percent
,
bias_correction
=
bias_correction
,
bias_correction
=
bias_correction
,
quantizable_op_type
=
quantizable_op_type
,
quantizable_op_type
=
quantizable_op_type
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录