Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
2946d312
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看板
提交
2946d312
编写于
4月 16, 2018
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update
上级
29c47d15
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
4 deletion
+6
-4
fluid/neural_machine_translation/transformer/config.py
fluid/neural_machine_translation/transformer/config.py
+1
-1
fluid/neural_machine_translation/transformer/train.py
fluid/neural_machine_translation/transformer/train.py
+5
-3
未找到文件。
fluid/neural_machine_translation/transformer/config.py
浏览文件 @
2946d312
...
@@ -4,7 +4,7 @@ class TrainTaskConfig(object):
...
@@ -4,7 +4,7 @@ class TrainTaskConfig(object):
pass_num
=
20
pass_num
=
20
# the number of sequences contained in a mini-batch.
# the number of sequences contained in a mini-batch.
batch_size
=
64
batch_size
=
32
# the hyper parameters for Adam optimizer.
# the hyper parameters for Adam optimizer.
learning_rate
=
0.001
learning_rate
=
0.001
...
...
fluid/neural_machine_translation/transformer/train.py
浏览文件 @
2946d312
...
@@ -196,24 +196,26 @@ def main():
...
@@ -196,24 +196,26 @@ def main():
loss_name
=
avg_cost
.
name
loss_name
=
avg_cost
.
name
if
TrainTaskConfig
.
use_avg_cost
else
sum_cost
.
name
)
if
TrainTaskConfig
.
use_avg_cost
else
sum_cost
.
name
)
local_scopes
=
train_exe
.
executor
.
local_scopes
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
for
pos_enc_param_name
in
pos_enc_param_names
:
for
pos_enc_param_name
in
pos_enc_param_names
:
tensor
=
position_encoding_init
(
ModelHyperParams
.
max_length
+
1
,
ModelHyperParams
.
d_model
)
tensor
=
position_encoding_init
(
ModelHyperParams
.
max_length
+
1
,
ModelHyperParams
.
d_model
)
for
place_id
,
local_scope
in
enumerate
(
local_scopes
):
for
place_id
in
xrange
(
dev_count
):
local_scope
=
train_exe
.
executor
.
local_scope
(
place_id
)
local_scope
.
find_var
(
pos_enc_param_name
).
get_tensor
().
set
(
tensor
,
fluid
.
CUDAPlace
(
place_id
))
local_scope
.
find_var
(
pos_enc_param_name
).
get_tensor
().
set
(
tensor
,
fluid
.
CUDAPlace
(
place_id
))
train_data
=
read_multiple
(
reader
=
train_data
,
count
=
dev_count
)
train_data
=
read_multiple
(
reader
=
train_data
,
count
=
dev_count
)
for
pass_id
in
xrange
(
TrainTaskConfig
.
pass_num
):
for
pass_id
in
xrange
(
TrainTaskConfig
.
pass_num
):
pass_start_time
=
time
.
time
()
pass_start_time
=
time
.
time
()
for
batch_id
,
data
in
enumerate
(
train_data
()):
for
batch_id
,
data
in
enumerate
(
train_data
()):
for
place_id
,
data_buffer
,
local_scope
in
zip
(
range
(
len
(
data
)),
data
,
local_scopes
):
for
place_id
,
data_buffer
in
enumerate
(
data
):
data_input_dict
,
util_input_dict
=
prepare_batch_input
(
data_input_dict
,
util_input_dict
=
prepare_batch_input
(
data_buffer
,
data_input_names
,
util_input_names
,
data_buffer
,
data_input_names
,
util_input_names
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
n_head
,
ModelHyperParams
.
d_model
)
ModelHyperParams
.
n_head
,
ModelHyperParams
.
d_model
)
local_scope
=
train_exe
.
executor
.
local_scope
(
place_id
)
local_scope
.
find_var
(
lr_scheduler
.
learning_rate
.
name
).
get_tensor
().
set
(
local_scope
.
find_var
(
lr_scheduler
.
learning_rate
.
name
).
get_tensor
().
set
(
lr_scheduler
.
update_learning_rate
(),
lr_scheduler
.
update_learning_rate
(),
fluid
.
CUDAPlace
(
place_id
))
fluid
.
CUDAPlace
(
place_id
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录