Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSlim
提交
f6b827fc
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看板
未验证
提交
f6b827fc
编写于
6月 08, 2022
作者:
G
Guanghua Yu
提交者:
GitHub
6月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix act logger (#1158)
上级
2952d4ce
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
9 deletion
+9
-9
paddleslim/auto_compression/compressor.py
paddleslim/auto_compression/compressor.py
+1
-3
paddleslim/quant/quant_post_hpo.py
paddleslim/quant/quant_post_hpo.py
+8
-6
未找到文件。
paddleslim/auto_compression/compressor.py
浏览文件 @
f6b827fc
...
...
@@ -18,8 +18,6 @@ import sys
import
numpy
as
np
import
inspect
import
shutil
from
collections
import
namedtuple
from
collections.abc
import
Iterable
from
time
import
gmtime
,
strftime
import
platform
import
paddle
...
...
@@ -392,7 +390,7 @@ class AutoCompression:
shutil
.
move
(
tmp_params_file
,
final_params_file
)
shutil
.
rmtree
(
self
.
tmp_dir
)
_logger
.
info
(
"==>
Finished the ACT process and the final model is saved in:{}
"
.
"==>
The ACT compression has been completed and the final model is saved in `{}`
"
.
format
(
final_model_path
))
os
.
_exit
(
0
)
...
...
paddleslim/quant/quant_post_hpo.py
浏览文件 @
f6b827fc
...
...
@@ -38,6 +38,8 @@ from smac.scenario.scenario import Scenario
from
paddleslim.common
import
get_logger
from
paddleslim.quant
import
quant_post
_logger
=
get_logger
(
__name__
,
level
=
logging
.
INFO
)
SMAC_TMP_FILE_PATTERN
=
"smac3-output*"
...
...
@@ -53,7 +55,7 @@ def remove(path):
os
.
remove
(
p
)
class
QuantConfig
:
class
QuantConfig
(
object
)
:
"""quant config"""
def
__init__
(
self
,
...
...
@@ -252,7 +254,7 @@ def eval_quant_model():
emd_sum
=
cal_emd_lose
(
out_float_list
,
out_quant_list
,
out_len_sum
/
float
(
valid_data_num
))
print
(
"output diff:"
,
emd_sum
)
_logger
.
info
(
"output diff: {}"
.
format
(
emd_sum
)
)
return
float
(
emd_sum
)
...
...
@@ -323,7 +325,7 @@ def quantize(cfg):
emd_loss
=
float
(
abs
(
float_metric
-
quant_metric
))
/
float_metric
print
(
"emd loss: "
,
emd_loss
)
_logger
.
info
(
"emd loss: {}"
.
format
(
emd_loss
)
)
if
emd_loss
<
g_min_emd_loss
:
g_min_emd_loss
=
emd_loss
if
os
.
path
.
exists
(
g_quant_config
.
quantize_model_path
):
...
...
@@ -510,7 +512,7 @@ def quant_post_hpo(
# Example call of the function with default values
# It returns: Status, Cost, Runtime, Additional Infos
def_value
=
smac
.
get_tae_runner
().
run
(
cs
.
get_default_configuration
(),
1
)[
1
]
print
(
"Value for default configuration: %.8f"
%
def_value
)
_logger
.
info
(
"Value for default configuration: %.8f"
%
def_value
)
# Start optimization
try
:
...
...
@@ -519,7 +521,7 @@ def quant_post_hpo(
incumbent
=
smac
.
solver
.
incumbent
inc_value
=
smac
.
get_tae_runner
().
run
(
incumbent
,
1
)[
1
]
print
(
"Optimized Value: %.8f"
%
inc_value
)
_logger
.
info
(
"Optimized Value: %.8f"
%
inc_value
)
shutil
.
rmtree
(
g_quant_model_cache_path
)
remove
(
SMAC_TMP_FILE_PATTERN
)
print
(
"quantize completed
"
)
_logger
.
info
(
"Quantization completed.
"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录