Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
PaddleRec
提交
8b7e1ed1
P
PaddleRec
项目概览
BaiXuePrincess
/
PaddleRec
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleRec
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleRec
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8b7e1ed1
编写于
8月 01, 2019
作者:
X
xiexionghang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for runnable trainer
上级
b1a8a46e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
19 addition
and
12 deletion
+19
-12
paddle/fluid/train/custom_trainer/feed/conf/gflags.conf
paddle/fluid/train/custom_trainer/feed/conf/gflags.conf
+1
-0
paddle/fluid/train/custom_trainer/feed/conf/trainer.yaml
paddle/fluid/train/custom_trainer/feed/conf/trainer.yaml
+6
-0
paddle/fluid/train/custom_trainer/feed/executor/executor.cc
paddle/fluid/train/custom_trainer/feed/executor/executor.cc
+6
-6
paddle/fluid/train/custom_trainer/feed/executor/executor.h
paddle/fluid/train/custom_trainer/feed/executor/executor.h
+2
-2
paddle/fluid/train/custom_trainer/feed/unit_test/test_executor.cc
...luid/train/custom_trainer/feed/unit_test/test_executor.cc
+4
-4
未找到文件。
paddle/fluid/train/custom_trainer/feed/conf/gflags.conf
0 → 100644
浏览文件 @
8b7e1ed1
-
v
=
10
paddle/fluid/train/custom_trainer/feed/conf/trainer.yaml
0 → 100644
浏览文件 @
8b7e1ed1
train_thread_num
:
10
environment
:
environment_class
:
MPIRuntimeEnvironment
epoch
:
epoch_class
:
HourlyEpochAccessor
paddle/fluid/train/custom_trainer/feed/executor/executor.cc
浏览文件 @
8b7e1ed1
...
@@ -43,7 +43,7 @@ std::unique_ptr<paddle::framework::ProgramDesc> Load(
...
@@ -43,7 +43,7 @@ std::unique_ptr<paddle::framework::ProgramDesc> Load(
}
}
struct
SimpleExecut
e
::
Context
{
struct
SimpleExecut
or
::
Context
{
Context
(
const
::
paddle
::
platform
::
Place
&
place
)
:
place
(
place
),
executor
(
place
)
{
Context
(
const
::
paddle
::
platform
::
Place
&
place
)
:
place
(
place
),
executor
(
place
)
{
}
}
const
::
paddle
::
platform
::
Place
&
place
;
const
::
paddle
::
platform
::
Place
&
place
;
...
@@ -54,15 +54,15 @@ struct SimpleExecute::Context {
...
@@ -54,15 +54,15 @@ struct SimpleExecute::Context {
};
};
SimpleExecut
e
::
SimpleExecute
()
{
SimpleExecut
or
::
SimpleExecutor
()
{
}
}
SimpleExecut
e
::~
SimpleExecute
()
{
SimpleExecut
or
::~
SimpleExecutor
()
{
}
}
int
SimpleExecut
e
::
initialize
(
YAML
::
Node
exe_config
,
int
SimpleExecut
or
::
initialize
(
YAML
::
Node
exe_config
,
std
::
shared_ptr
<
TrainerContext
>
context_ptr
)
{
std
::
shared_ptr
<
TrainerContext
>
context_ptr
)
{
paddle
::
framework
::
InitDevices
(
false
);
paddle
::
framework
::
InitDevices
(
false
);
...
@@ -79,7 +79,7 @@ int SimpleExecute::initialize(YAML::Node exe_config,
...
@@ -79,7 +79,7 @@ int SimpleExecute::initialize(YAML::Node exe_config,
}
}
try
{
try
{
_context
.
reset
(
new
SimpleExecut
e
::
Context
(
context_ptr
->
cpu_place
));
_context
.
reset
(
new
SimpleExecut
or
::
Context
(
context_ptr
->
cpu_place
));
auto
startup_program
=
Load
(
&
_context
->
executor
,
exe_config
[
"startup_program"
].
as
<
std
::
string
>
());
auto
startup_program
=
Load
(
&
_context
->
executor
,
exe_config
[
"startup_program"
].
as
<
std
::
string
>
());
if
(
startup_program
==
nullptr
)
{
if
(
startup_program
==
nullptr
)
{
VLOG
(
2
)
<<
"fail to load startup_program: "
<<
exe_config
[
"startup_program"
].
as
<
std
::
string
>
();
VLOG
(
2
)
<<
"fail to load startup_program: "
<<
exe_config
[
"startup_program"
].
as
<
std
::
string
>
();
...
@@ -104,7 +104,7 @@ int SimpleExecute::initialize(YAML::Node exe_config,
...
@@ -104,7 +104,7 @@ int SimpleExecute::initialize(YAML::Node exe_config,
return
0
;
return
0
;
}
}
int
SimpleExecut
e
::
run
()
{
int
SimpleExecut
or
::
run
()
{
if
(
_context
==
nullptr
)
{
if
(
_context
==
nullptr
)
{
VLOG
(
2
)
<<
"need initialize before run"
;
VLOG
(
2
)
<<
"need initialize before run"
;
return
-
1
;
return
-
1
;
...
...
paddle/fluid/train/custom_trainer/feed/executor/executor.h
浏览文件 @
8b7e1ed1
...
@@ -44,8 +44,8 @@ REGISTER_REGISTERER(Executor);
...
@@ -44,8 +44,8 @@ REGISTER_REGISTERER(Executor);
class
SimpleExecutor
:
public
Executor
{
class
SimpleExecutor
:
public
Executor
{
public:
public:
SimpleExecut
e
();
SimpleExecut
or
();
virtual
~
SimpleExecut
e
();
virtual
~
SimpleExecut
or
();
virtual
int
initialize
(
YAML
::
Node
exe_config
,
virtual
int
initialize
(
YAML
::
Node
exe_config
,
std
::
shared_ptr
<
TrainerContext
>
context_ptr
);
std
::
shared_ptr
<
TrainerContext
>
context_ptr
);
virtual
int
run
();
virtual
int
run
();
...
...
paddle/fluid/train/custom_trainer/feed/unit_test/test_executor.cc
浏览文件 @
8b7e1ed1
...
@@ -22,8 +22,8 @@ namespace paddle {
...
@@ -22,8 +22,8 @@ namespace paddle {
namespace
custom_trainer
{
namespace
custom_trainer
{
namespace
feed
{
namespace
feed
{
TEST
(
testSimpleExecut
e
,
initialize
)
{
TEST
(
testSimpleExecut
or
,
initialize
)
{
SimpleExecut
e
execute
;
SimpleExecut
or
execute
;
auto
context_ptr
=
std
::
make_shared
<
TrainerContext
>
();
auto
context_ptr
=
std
::
make_shared
<
TrainerContext
>
();
YAML
::
Node
config
=
YAML
::
Load
(
"[1, 2, 3]"
);
YAML
::
Node
config
=
YAML
::
Load
(
"[1, 2, 3]"
);
ASSERT_NE
(
0
,
execute
.
initialize
(
config
,
context_ptr
));
ASSERT_NE
(
0
,
execute
.
initialize
(
config
,
context_ptr
));
...
@@ -54,8 +54,8 @@ void next_batch(int batch_size, const paddle::platform::Place& place, paddle::fr
...
@@ -54,8 +54,8 @@ void next_batch(int batch_size, const paddle::platform::Place& place, paddle::fr
}
}
}
}
TEST
(
testSimpleExecut
e
,
run
)
{
TEST
(
testSimpleExecut
or
,
run
)
{
SimpleExecut
e
execute
;
SimpleExecut
or
execute
;
auto
context_ptr
=
std
::
make_shared
<
TrainerContext
>
();
auto
context_ptr
=
std
::
make_shared
<
TrainerContext
>
();
auto
config
=
YAML
::
Load
(
"{thread_num: 2, startup_program: ./data/startup_program, main_program: ./data/main_program}"
);
auto
config
=
YAML
::
Load
(
"{thread_num: 2, startup_program: ./data/startup_program, main_program: ./data/main_program}"
);
ASSERT_EQ
(
0
,
execute
.
initialize
(
config
,
context_ptr
));
ASSERT_EQ
(
0
,
execute
.
initialize
(
config
,
context_ptr
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录