Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
1d63dafd
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看板
提交
1d63dafd
编写于
10月 15, 2018
作者:
G
gongweibao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
bb696e5b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
4 deletion
+20
-4
fluid/neural_machine_translation/transformer/config.py
fluid/neural_machine_translation/transformer/config.py
+1
-0
fluid/neural_machine_translation/transformer/train.py
fluid/neural_machine_translation/transformer/train.py
+19
-4
未找到文件。
fluid/neural_machine_translation/transformer/config.py
浏览文件 @
1d63dafd
...
...
@@ -32,6 +32,7 @@ class TrainTaskConfig(object):
start_step
=
0
# the frequency to save trained models.
save_freq
=
10000
profile
=
True
class
InferTaskConfig
(
object
):
...
...
fluid/neural_machine_translation/transformer/train.py
浏览文件 @
1d63dafd
...
...
@@ -7,6 +7,7 @@ import time
import
numpy
as
np
import
paddle.fluid
as
fluid
import
paddle.fluid.profiler
as
profiler
import
reader
from
config
import
*
...
...
@@ -130,6 +131,9 @@ def parse_args():
default
=
100
,
help
=
"Fetch outputs steps."
)
#parser.add_argument(
# '--profile', action='store_true', help='If set, profile a few steps.')
args
=
parser
.
parse_args
()
# Append args related to dict
...
...
@@ -467,7 +471,7 @@ def train_loop(exe, train_prog, startup_prog, dev_count, sum_cost, avg_cost,
#build_strategy.gradient_scale_strategy = fluid.BuildStrategy.GradientScaleStrategy.Customized
exec_strategy
=
fluid
.
ExecutionStrategy
()
if
args
.
update_method
==
"nccl2"
:
#
if args.update_method == "nccl2":
exec_strategy
.
num_threads
=
1
logging
.
info
(
"begin executor"
)
...
...
@@ -509,11 +513,22 @@ def train_loop(exe, train_prog, startup_prog, dev_count, sum_cost, avg_cost,
feed_dict_list
=
prepare_feed_dict_list
(
data_generator
,
init_flag
,
dev_count
)
if
TrainTaskConfig
.
profile
and
batch_id
==
5
:
logging
.
info
(
"begin profiler"
)
profiler
.
start_profiler
(
"All"
)
profiler
.
reset_profiler
()
elif
TrainTaskConfig
.
profile
and
batch_id
==
10
:
logging
.
info
(
"end profiler"
)
#logging.info("profiling total time: ", time.time() - start_time)
profiler
.
stop_profiler
(
"total"
,
"./transformer_local_profile_{}_pass{}"
.
format
(
batch_id
,
pass_id
))
sys
.
exit
(
0
)
logging
.
info
(
"batch_id:{}"
.
format
(
batch_id
))
outs
=
train_exe
.
run
(
fetch_list
=
[
sum_cost
.
name
,
token_num
.
name
]
if
batch_id
%
args
.
fetch_steps
==
0
else
[],
fetch_list
=
[
sum_cost
.
name
,
token_num
.
name
]
if
(
batch_id
%
args
.
fetch_steps
==
0
or
TrainTaskConfig
.
profile
)
else
[],
feed
=
feed_dict_list
)
if
batch_id
%
args
.
fetch_steps
==
0
and
batch_id
>
0
:
if
(
batch_id
%
args
.
fetch_steps
==
0
and
batch_id
>
0
)
:
sum_cost_val
,
token_num_val
=
np
.
array
(
outs
[
0
]),
np
.
array
(
outs
[
1
])
# sum the cost from multi-devices
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录