Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
00455839
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
00455839
编写于
7月 29, 2021
作者:
Y
Yiqun Liu
提交者:
GitHub
7月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add the profiler back for static training. (#1094)
上级
274f8190
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
3 deletion
+13
-3
ppcls/static/program.py
ppcls/static/program.py
+5
-2
ppcls/static/train.py
ppcls/static/train.py
+8
-1
未找到文件。
ppcls/static/program.py
浏览文件 @
00455839
...
@@ -38,7 +38,7 @@ from ppcls.optimizer import build_optimizer
...
@@ -38,7 +38,7 @@ from ppcls.optimizer import build_optimizer
from
ppcls.optimizer
import
build_lr_scheduler
from
ppcls.optimizer
import
build_lr_scheduler
from
ppcls.utils.misc
import
AverageMeter
from
ppcls.utils.misc
import
AverageMeter
from
ppcls.utils
import
logger
from
ppcls.utils
import
logger
,
profiler
def
create_feeds
(
image_shape
,
use_mix
=
None
,
dtype
=
"float32"
):
def
create_feeds
(
image_shape
,
use_mix
=
None
,
dtype
=
"float32"
):
...
@@ -326,7 +326,8 @@ def run(dataloader,
...
@@ -326,7 +326,8 @@ def run(dataloader,
mode
=
'train'
,
mode
=
'train'
,
config
=
None
,
config
=
None
,
vdl_writer
=
None
,
vdl_writer
=
None
,
lr_scheduler
=
None
):
lr_scheduler
=
None
,
profiler_options
=
None
):
"""
"""
Feed data to the model and fetch the measures and loss
Feed data to the model and fetch the measures and loss
...
@@ -382,6 +383,8 @@ def run(dataloader,
...
@@ -382,6 +383,8 @@ def run(dataloader,
metric_dict
[
'reader_time'
].
update
(
time
.
time
()
-
tic
)
metric_dict
[
'reader_time'
].
update
(
time
.
time
()
-
tic
)
profiler
.
add_profiler_step
(
profiler_options
)
if
use_dali
:
if
use_dali
:
batch_size
=
batch
[
0
][
"data"
].
shape
()[
0
]
batch_size
=
batch
[
0
][
"data"
].
shape
()[
0
]
feed_dict
=
batch
[
0
]
feed_dict
=
batch
[
0
]
...
...
ppcls/static/train.py
浏览文件 @
00455839
...
@@ -43,6 +43,13 @@ def parse_args():
...
@@ -43,6 +43,13 @@ def parse_args():
type
=
str
,
type
=
str
,
default
=
'configs/ResNet/ResNet50.yaml'
,
default
=
'configs/ResNet/ResNet50.yaml'
,
help
=
'config file path'
)
help
=
'config file path'
)
parser
.
add_argument
(
'-p'
,
'--profiler_options'
,
type
=
str
,
default
=
None
,
help
=
'The option of profiler, which should be in format
\"
key1=value1;key2=value2;key3=value3
\"
.'
)
parser
.
add_argument
(
parser
.
add_argument
(
'-o'
,
'-o'
,
'--override'
,
'--override'
,
...
@@ -166,7 +173,7 @@ def main(args):
...
@@ -166,7 +173,7 @@ def main(args):
# 1. train with train dataset
# 1. train with train dataset
program
.
run
(
train_dataloader
,
exe
,
compiled_train_prog
,
train_feeds
,
program
.
run
(
train_dataloader
,
exe
,
compiled_train_prog
,
train_feeds
,
train_fetchs
,
epoch_id
,
'train'
,
config
,
vdl_writer
,
train_fetchs
,
epoch_id
,
'train'
,
config
,
vdl_writer
,
lr_scheduler
)
lr_scheduler
,
args
.
profiler_options
)
# 2. evaate with eval dataset
# 2. evaate with eval dataset
if
global_config
[
"eval_during_train"
]
and
epoch_id
%
global_config
[
if
global_config
[
"eval_during_train"
]
and
epoch_id
%
global_config
[
"eval_interval"
]
==
0
:
"eval_interval"
]
==
0
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录