Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
89316571
M
models
项目概览
PaddlePaddle
/
models
1 年多 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
89316571
编写于
12月 25, 2019
作者:
M
mmglove
提交者:
whs
12月 25, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ce for slim (#4119)
上级
68d17711
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
0 deletion
+22
-0
PaddleSlim/classification/distillation/compress.py
PaddleSlim/classification/distillation/compress.py
+8
-0
PaddleSlim/classification/pruning/compress.py
PaddleSlim/classification/pruning/compress.py
+7
-0
PaddleSlim/compress.py
PaddleSlim/compress.py
+7
-0
未找到文件。
PaddleSlim/classification/distillation/compress.py
浏览文件 @
89316571
...
...
@@ -34,12 +34,20 @@ add_arg('pretrained_model', str, None, "Whether to use pretraine
add_arg
(
'teacher_model'
,
str
,
None
,
"Set the teacher network to use."
)
add_arg
(
'teacher_pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'compress_config'
,
str
,
None
,
"The config file for compression with yaml format."
)
add_arg
(
'enable_ce'
,
bool
,
False
,
"If set, run the task with continuous evaluation logs."
)
# yapf: enable
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
def
compress
(
args
):
# add ce
if
args
.
enable_ce
:
SEED
=
1
fluid
.
default_main_program
().
random_seed
=
SEED
fluid
.
default_startup_program
().
random_seed
=
SEED
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
assert
args
.
model
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
...
...
PaddleSlim/classification/pruning/compress.py
浏览文件 @
89316571
...
...
@@ -33,6 +33,7 @@ add_arg('num_epochs', int, 120, "The number of total epochs
add_arg
(
'total_images'
,
int
,
1281167
,
"The number of total training images."
)
parser
.
add_argument
(
'--step_epochs'
,
nargs
=
'+'
,
type
=
int
,
default
=
[
30
,
60
,
90
],
help
=
"piecewise decay step"
)
add_arg
(
'config_file'
,
str
,
None
,
"The config file for compression with yaml format."
)
add_arg
(
'enable_ce'
,
bool
,
False
,
"If set, run the task with continuous evaluation logs."
)
# yapf: enable
...
...
@@ -68,6 +69,12 @@ def create_optimizer(args):
return
cosine_decay
(
args
)
def
compress
(
args
):
# add ce
if
args
.
enable_ce
:
SEED
=
1
fluid
.
default_main_program
().
random_seed
=
SEED
fluid
.
default_startup_program
().
random_seed
=
SEED
class_dim
=
1000
image_shape
=
"3,224,224"
image_shape
=
[
int
(
m
)
for
m
in
image_shape
.
split
(
","
)]
...
...
PaddleSlim/compress.py
浏览文件 @
89316571
...
...
@@ -33,12 +33,19 @@ add_arg('teacher_model', str, None, "Set the teacher network to use
add_arg
(
'teacher_pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'compress_config'
,
str
,
None
,
"The config file for compression with yaml format."
)
add_arg
(
'quant_only'
,
bool
,
False
,
"Only do quantization-aware training."
)
add_arg
(
'enable_ce'
,
bool
,
False
,
"If set, run the task with continuous evaluation logs."
)
# yapf: enable
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
def
compress
(
args
):
# add ce
if
args
.
enable_ce
:
SEED
=
1
fluid
.
default_main_program
().
random_seed
=
SEED
fluid
.
default_startup_program
().
random_seed
=
SEED
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
assert
args
.
model
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录