Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
ba239be3
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看板
提交
ba239be3
编写于
10月 29, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of upstream into agg_nlp_models
上级
ffa113fd
01fe704e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
8 deletion
+10
-8
fluid/PaddleNLP/neural_machine_translation/transformer/train.py
...PaddleNLP/neural_machine_translation/transformer/train.py
+10
-8
未找到文件。
fluid/PaddleNLP/neural_machine_translation/transformer/train.py
浏览文件 @
ba239be3
...
@@ -145,14 +145,15 @@ def parse_args():
...
@@ -145,14 +145,15 @@ def parse_args():
return
args
return
args
def
append_nccl2_prepare
(
trainer_id
,
worker_endpoints
,
current_endpoint
):
def
append_nccl2_prepare
(
startup_prog
,
trainer_id
,
worker_endpoints
,
current_endpoint
):
assert
(
trainer_id
>=
0
and
len
(
worker_endpoints
)
>
1
and
assert
(
trainer_id
>=
0
and
len
(
worker_endpoints
)
>
1
and
current_endpoint
in
worker_endpoints
)
current_endpoint
in
worker_endpoints
)
eps
=
copy
.
deepcopy
(
worker_endpoints
)
eps
=
copy
.
deepcopy
(
worker_endpoints
)
eps
.
remove
(
current_endpoint
)
eps
.
remove
(
current_endpoint
)
nccl_id_var
=
fluid
.
default_startup_program
()
.
global_block
().
create_var
(
nccl_id_var
=
startup_prog
.
global_block
().
create_var
(
name
=
"NCCLID"
,
persistable
=
True
,
type
=
fluid
.
core
.
VarDesc
.
VarType
.
RAW
)
name
=
"NCCLID"
,
persistable
=
True
,
type
=
fluid
.
core
.
VarDesc
.
VarType
.
RAW
)
fluid
.
default_startup_program
()
.
global_block
().
append_op
(
startup_prog
.
global_block
().
append_op
(
type
=
"gen_nccl_id"
,
type
=
"gen_nccl_id"
,
inputs
=
{},
inputs
=
{},
outputs
=
{
"NCCLID"
:
nccl_id_var
},
outputs
=
{
"NCCLID"
:
nccl_id_var
},
...
@@ -403,7 +404,7 @@ def test_context(exe, train_exe, dev_count):
...
@@ -403,7 +404,7 @@ def test_context(exe, train_exe, dev_count):
TrainTaskConfig
.
label_smooth_eps
,
TrainTaskConfig
.
label_smooth_eps
,
use_py_reader
=
args
.
use_py_reader
,
use_py_reader
=
args
.
use_py_reader
,
is_test
=
True
)
is_test
=
True
)
test_prog
=
test_prog
.
clone
(
for_test
=
True
)
test_data
=
prepare_data_generator
(
test_data
=
prepare_data_generator
(
args
,
is_test
=
True
,
count
=
dev_count
,
pyreader
=
pyreader
)
args
,
is_test
=
True
,
count
=
dev_count
,
pyreader
=
pyreader
)
...
@@ -680,10 +681,11 @@ def train(args):
...
@@ -680,10 +681,11 @@ def train(args):
logging
.
info
(
"trainers_num:{}"
.
format
(
trainers_num
))
logging
.
info
(
"trainers_num:{}"
.
format
(
trainers_num
))
logging
.
info
(
"worker_endpoints:{}"
.
format
(
worker_endpoints
))
logging
.
info
(
"worker_endpoints:{}"
.
format
(
worker_endpoints
))
logging
.
info
(
"current_endpoint:{}"
.
format
(
current_endpoint
))
logging
.
info
(
"current_endpoint:{}"
.
format
(
current_endpoint
))
append_nccl2_prepare
(
trainer_id
,
worker_endpoints
,
current_endpoint
)
append_nccl2_prepare
(
startup_prog
,
trainer_id
,
worker_endpoints
,
train_loop
(
exe
,
current_endpoint
)
fluid
.
default_main_program
(),
dev_count
,
sum_cost
,
train_loop
(
exe
,
train_prog
,
startup_prog
,
dev_count
,
sum_cost
,
avg_cost
,
token_num
,
predict
,
trainers_num
,
trainer_id
)
avg_cost
,
token_num
,
predict
,
pyreader
,
trainers_num
,
trainer_id
)
return
return
port
=
os
.
getenv
(
"PADDLE_PORT"
,
"6174"
)
port
=
os
.
getenv
(
"PADDLE_PORT"
,
"6174"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录