Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
ffbf5f7f
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看板
未验证
提交
ffbf5f7f
编写于
8月 25, 2018
作者:
G
guochaorong
提交者:
GitHub
8月 25, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1185 from guoshengCS/fix-until-input-transformer
Fix the unremoved util_input in Transformer
上级
597bae24
bb947505
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
9 deletion
+5
-9
fluid/neural_machine_translation/transformer/config.py
fluid/neural_machine_translation/transformer/config.py
+0
-3
fluid/neural_machine_translation/transformer/train.py
fluid/neural_machine_translation/transformer/train.py
+5
-6
未找到文件。
fluid/neural_machine_translation/transformer/config.py
浏览文件 @
ffbf5f7f
...
@@ -190,6 +190,3 @@ fast_decoder_data_input_fields = (
...
@@ -190,6 +190,3 @@ fast_decoder_data_input_fields = (
"trg_word"
,
"trg_word"
,
"init_score"
,
"init_score"
,
"trg_src_attn_bias"
,
)
"trg_src_attn_bias"
,
)
# fast_decoder_util_input_fields = (
# "trg_slf_attn_pre_softmax_shape_delta",
# "trg_slf_attn_post_softmax_shape_delta", )
fluid/neural_machine_translation/transformer/train.py
浏览文件 @
ffbf5f7f
...
@@ -258,7 +258,7 @@ def split_data(data, num_part):
...
@@ -258,7 +258,7 @@ def split_data(data, num_part):
def
test_context
(
train_progm
,
avg_cost
,
train_exe
,
dev_count
,
data_input_names
,
def
test_context
(
train_progm
,
avg_cost
,
train_exe
,
dev_count
,
data_input_names
,
util_input_names
,
sum_cost
,
token_num
):
sum_cost
,
token_num
):
# Context to do validation.
# Context to do validation.
test_program
=
train_progm
.
clone
()
test_program
=
train_progm
.
clone
()
with
fluid
.
program_guard
(
test_program
):
with
fluid
.
program_guard
(
test_program
):
...
@@ -299,9 +299,9 @@ def test_context(train_progm, avg_cost, train_exe, dev_count, data_input_names,
...
@@ -299,9 +299,9 @@ def test_context(train_progm, avg_cost, train_exe, dev_count, data_input_names,
split_data
(
split_data
(
data
,
num_part
=
dev_count
)):
data
,
num_part
=
dev_count
)):
data_input_dict
,
_
=
prepare_batch_input
(
data_input_dict
,
_
=
prepare_batch_input
(
data_buffer
,
data_input_names
,
util_input_names
,
data_buffer
,
data_input_names
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
eos_idx
,
ModelHyperParams
.
n_head
,
ModelHyperParams
.
n_head
,
ModelHyperParams
.
d_model
)
ModelHyperParams
.
d_model
)
feed_list
.
append
(
data_input_dict
)
feed_list
.
append
(
data_input_dict
)
outs
=
exe
.
run
(
feed
=
feed_list
,
outs
=
exe
.
run
(
feed
=
feed_list
,
...
@@ -363,8 +363,7 @@ def train_loop(exe, train_progm, dev_count, sum_cost, avg_cost, lr_scheduler,
...
@@ -363,8 +363,7 @@ def train_loop(exe, train_progm, dev_count, sum_cost, avg_cost, lr_scheduler,
if
args
.
val_file_pattern
is
not
None
:
if
args
.
val_file_pattern
is
not
None
:
test
=
test_context
(
train_progm
,
avg_cost
,
train_exe
,
dev_count
,
test
=
test_context
(
train_progm
,
avg_cost
,
train_exe
,
dev_count
,
data_input_names
,
util_input_names
,
sum_cost
,
data_input_names
,
sum_cost
,
token_num
)
token_num
)
# the best cross-entropy value with label smoothing
# the best cross-entropy value with label smoothing
loss_normalizer
=
-
((
1.
-
TrainTaskConfig
.
label_smooth_eps
)
*
np
.
log
(
loss_normalizer
=
-
((
1.
-
TrainTaskConfig
.
label_smooth_eps
)
*
np
.
log
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录