Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
eed924a6
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看板
提交
eed924a6
编写于
12月 11, 2019
作者:
H
hysunflower
提交者:
Jinhua Liang
12月 11, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add_profiler_nextvlad (#4058)
上级
9aefcdc8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
2 deletion
+24
-2
PaddleCV/PaddleVideo/train.py
PaddleCV/PaddleVideo/train.py
+14
-1
PaddleCV/PaddleVideo/utils/train_utils.py
PaddleCV/PaddleVideo/utils/train_utils.py
+10
-1
未找到文件。
PaddleCV/PaddleVideo/train.py
浏览文件 @
eed924a6
...
@@ -104,6 +104,17 @@ def parse_args():
...
@@ -104,6 +104,17 @@ def parse_args():
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
default
=
False
,
default
=
False
,
help
=
'If set True, enable continuous evaluation job.'
)
help
=
'If set True, enable continuous evaluation job.'
)
# NOTE: args for profiler, used for benchmark
parser
.
add_argument
(
'--profiler_path'
,
type
=
str
,
default
=
'./'
,
help
=
'the path to store profiler output file. used for benchmark.'
)
parser
.
add_argument
(
'--is_profiler'
,
type
=
int
,
default
=
0
,
help
=
'the switch profiler. used for benchmark.'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
...
@@ -236,7 +247,9 @@ def train(args):
...
@@ -236,7 +247,9 @@ def train(args):
compiled_test_prog
=
compiled_valid_prog
,
#test_exe=valid_exe,
compiled_test_prog
=
compiled_valid_prog
,
#test_exe=valid_exe,
test_dataloader
=
valid_dataloader
,
test_dataloader
=
valid_dataloader
,
test_fetch_list
=
valid_fetch_list
,
test_fetch_list
=
valid_fetch_list
,
test_metrics
=
valid_metrics
)
test_metrics
=
valid_metrics
,
is_profiler
=
args
.
is_profiler
,
profiler_path
=
args
.
profiler_path
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
PaddleCV/PaddleVideo/utils/train_utils.py
浏览文件 @
eed924a6
...
@@ -18,6 +18,7 @@ import time
...
@@ -18,6 +18,7 @@ import time
import
numpy
as
np
import
numpy
as
np
import
paddle
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
from
paddle.fluid
import
profiler
import
logging
import
logging
import
shutil
import
shutil
...
@@ -76,7 +77,8 @@ def train_with_dataloader(exe, train_prog, compiled_train_prog, train_dataloader
...
@@ -76,7 +77,8 @@ def train_with_dataloader(exe, train_prog, compiled_train_prog, train_dataloader
log_interval
=
0
,
valid_interval
=
0
,
save_dir
=
'./'
,
\
log_interval
=
0
,
valid_interval
=
0
,
save_dir
=
'./'
,
\
save_model_name
=
'model'
,
fix_random_seed
=
False
,
\
save_model_name
=
'model'
,
fix_random_seed
=
False
,
\
compiled_test_prog
=
None
,
test_dataloader
=
None
,
\
compiled_test_prog
=
None
,
test_dataloader
=
None
,
\
test_fetch_list
=
None
,
test_metrics
=
None
):
test_fetch_list
=
None
,
test_metrics
=
None
,
\
is_profiler
=
None
,
profiler_path
=
None
):
if
not
train_dataloader
:
if
not
train_dataloader
:
logger
.
error
(
"[TRAIN] get dataloader failed."
)
logger
.
error
(
"[TRAIN] get dataloader failed."
)
epoch_periods
=
[]
epoch_periods
=
[]
...
@@ -98,6 +100,13 @@ def train_with_dataloader(exe, train_prog, compiled_train_prog, train_dataloader
...
@@ -98,6 +100,13 @@ def train_with_dataloader(exe, train_prog, compiled_train_prog, train_dataloader
train_metrics
.
calculate_and_log_out
(
train_outs
,
\
train_metrics
.
calculate_and_log_out
(
train_outs
,
\
info
=
'[TRAIN] Epoch {}, iter {} '
.
format
(
epoch
,
train_iter
))
info
=
'[TRAIN] Epoch {}, iter {} '
.
format
(
epoch
,
train_iter
))
train_iter
+=
1
train_iter
+=
1
# NOTE: profiler tools, used for benchmark
if
is_profiler
and
epoch
==
0
and
train_iter
==
log_interval
:
profiler
.
start_profiler
(
"All"
)
elif
is_profiler
and
epoch
==
0
and
train_iter
==
log_interval
+
5
:
profiler
.
stop_profiler
(
"total"
,
profiler_path
)
return
if
len
(
epoch_periods
)
<
1
:
if
len
(
epoch_periods
)
<
1
:
logger
.
info
(
logger
.
info
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录