Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
4fbfc011
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4fbfc011
编写于
4月 18, 2019
作者:
W
whs
提交者:
GitHub
4月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Restore quantization and distillation stategy before loading persistables. (#16959)
test=develop
上级
5a2d6d6b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
6 deletion
+11
-6
python/paddle/fluid/contrib/slim/core/compressor.py
python/paddle/fluid/contrib/slim/core/compressor.py
+3
-0
python/paddle/fluid/contrib/slim/core/strategy.py
python/paddle/fluid/contrib/slim/core/strategy.py
+3
-0
python/paddle/fluid/contrib/slim/distillation/distillation_strategy.py
.../fluid/contrib/slim/distillation/distillation_strategy.py
+1
-1
python/paddle/fluid/contrib/slim/quantization/quantization_strategy.py
.../fluid/contrib/slim/quantization/quantization_strategy.py
+4
-5
未找到文件。
python/paddle/fluid/contrib/slim/core/compressor.py
浏览文件 @
4fbfc011
...
...
@@ -363,6 +363,9 @@ class Compressor(object):
strategies
=
pickle
.
load
(
strategy_file
,
encoding
=
'bytes'
)
for
strategy
in
strategies
:
strategy
.
restore_from_checkpoint
(
context
)
if
os
.
path
.
exists
(
model_path
):
exe
=
SlimGraphExecutor
(
context
.
place
)
with
scope_guard
(
context
.
scope
):
...
...
python/paddle/fluid/contrib/slim/core/strategy.py
浏览文件 @
4fbfc011
...
...
@@ -46,3 +46,6 @@ class Strategy(object):
def
on_compression_end
(
self
,
context
):
pass
def
restore_from_checkpoint
(
self
,
context
):
pass
python/paddle/fluid/contrib/slim/distillation/distillation_strategy.py
浏览文件 @
4fbfc011
...
...
@@ -38,7 +38,7 @@ class DistillationStrategy(Strategy):
super
(
DistillationStrategy
,
self
).
__init__
(
start_epoch
,
end_epoch
)
self
.
distillers
=
distillers
def
on_compression_begin
(
self
,
context
):
def
restore_from_checkpoint
(
self
,
context
):
# load from checkpoint
if
context
.
epoch_id
>
0
:
if
context
.
epoch_id
>
self
.
start_epoch
and
context
.
epoch_id
<
self
.
end_epoch
:
...
...
python/paddle/fluid/contrib/slim/quantization/quantization_strategy.py
浏览文件 @
4fbfc011
...
...
@@ -88,7 +88,7 @@ class QuantizationStrategy(Strategy):
self
.
save_out_nodes
=
save_out_nodes
self
.
save_in_nodes
=
save_in_nodes
def
on_compression_begin
(
self
,
context
):
def
restore_from_checkpoint
(
self
,
context
):
"""
Restore graph when the compressoin task is inited from checkpoint.
"""
...
...
@@ -143,10 +143,9 @@ class QuantizationStrategy(Strategy):
train_ir_graph
.
graph
).
with_data_parallel
(
loss_name
=
context
.
optimize_graph
.
out_nodes
[
'loss'
],
build_strategy
=
build_strategy
)
# for evaluation. And program compiled from ir graph must be with data parallel.
context
.
eval_graph
.
compiled_graph
=
CompiledProgram
(
test_ir_graph
.
graph
).
with_data_parallel
(
build_strategy
=
build_strategy
)
context
.
eval_graph
.
program
=
test_ir_graph
.
to_program
()
# for saving inference model after training
context
.
put
(
'quantization_test_ir_graph_backup'
,
test_ir_graph
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录