Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
ERNIE
提交
4650e959
E
ERNIE
项目概览
PaddlePaddle
/
ERNIE
大约 1 年 前同步成功
通知
109
Star
5997
Fork
1270
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
29
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
ERNIE
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
29
Issue
29
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4650e959
编写于
6月 19, 2019
作者:
T
tianxin04
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/PaddlePaddle/LARK
into develop
上级
ad7ebbae
da736152
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
35 addition
and
17 deletion
+35
-17
BERT/train.py
BERT/train.py
+32
-15
ELMo/README.md
ELMo/README.md
+1
-1
ELMo/train.py
ELMo/train.py
+1
-0
ERNIE/finetune/classifier.py
ERNIE/finetune/classifier.py
+1
-1
未找到文件。
BERT/train.py
浏览文件 @
4650e959
...
@@ -313,6 +313,9 @@ def train(args):
...
@@ -313,6 +313,9 @@ def train(args):
exec_strategy
.
num_threads
=
dev_count
exec_strategy
.
num_threads
=
dev_count
exec_strategy
.
num_iteration_per_drop_scope
=
args
.
num_iteration_per_drop_scope
exec_strategy
.
num_iteration_per_drop_scope
=
args
.
num_iteration_per_drop_scope
# use_ngraph is for CPU only, please refer to README_ngraph.md for details
use_ngraph
=
os
.
getenv
(
'FLAGS_use_ngraph'
)
if
not
use_ngraph
:
train_exe
=
fluid
.
ParallelExecutor
(
train_exe
=
fluid
.
ParallelExecutor
(
use_cuda
=
args
.
use_cuda
,
use_cuda
=
args
.
use_cuda
,
loss_name
=
total_loss
.
name
,
loss_name
=
total_loss
.
name
,
...
@@ -320,6 +323,8 @@ def train(args):
...
@@ -320,6 +323,8 @@ def train(args):
main_program
=
train_program
,
main_program
=
train_program
,
num_trainers
=
nccl2_num_trainers
,
num_trainers
=
nccl2_num_trainers
,
trainer_id
=
nccl2_trainer_id
)
trainer_id
=
nccl2_trainer_id
)
else
:
train_exe
=
exe
if
args
.
validation_set_dir
and
args
.
validation_set_dir
!=
""
:
if
args
.
validation_set_dir
and
args
.
validation_set_dir
!=
""
:
predict
=
predict_wrapper
(
predict
=
predict_wrapper
(
...
@@ -345,17 +350,30 @@ def train(args):
...
@@ -345,17 +350,30 @@ def train(args):
skip_steps
=
args
.
skip_steps
*
nccl2_num_trainers
skip_steps
=
args
.
skip_steps
*
nccl2_num_trainers
if
nccl2_trainer_id
!=
0
:
if
nccl2_trainer_id
!=
0
:
if
use_ngraph
:
train_exe
.
run
(
fetch_list
=
[],
program
=
train_program
)
else
:
train_exe
.
run
(
fetch_list
=
[])
train_exe
.
run
(
fetch_list
=
[])
continue
continue
if
steps
%
skip_steps
!=
0
:
if
steps
%
skip_steps
!=
0
:
if
use_ngraph
:
train_exe
.
run
(
fetch_list
=
[],
program
=
train_program
)
else
:
train_exe
.
run
(
fetch_list
=
[])
train_exe
.
run
(
fetch_list
=
[])
else
:
else
:
if
use_ngraph
:
each_next_acc
,
each_mask_lm_cost
,
each_total_cost
,
np_lr
=
train_exe
.
run
(
each_next_acc
,
each_mask_lm_cost
,
each_total_cost
,
np_lr
=
train_exe
.
run
(
fetch_list
=
[
fetch_list
=
[
next_sent_acc
.
name
,
mask_lm_loss
.
name
,
total_loss
.
name
,
next_sent_acc
.
name
,
mask_lm_loss
.
name
,
total_loss
.
name
,
scheduled_lr
.
name
scheduled_lr
.
name
],
program
=
train_program
)
])
else
:
each_next_acc
,
each_mask_lm_cost
,
each_total_cost
,
np_lr
=
train_exe
.
run
(
fetch_list
=
[
next_sent_acc
.
name
,
mask_lm_loss
.
name
,
total_loss
.
name
,
scheduled_lr
.
name
])
acc
.
extend
(
each_next_acc
)
acc
.
extend
(
each_next_acc
)
lm_cost
.
extend
(
each_mask_lm_cost
)
lm_cost
.
extend
(
each_mask_lm_cost
)
cost
.
extend
(
each_total_cost
)
cost
.
extend
(
each_total_cost
)
...
@@ -398,7 +416,6 @@ def train(args):
...
@@ -398,7 +416,6 @@ def train(args):
train_pyreader
.
reset
()
train_pyreader
.
reset
()
break
break
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
print_arguments
(
args
)
print_arguments
(
args
)
if
args
.
do_test
:
if
args
.
do_test
:
...
...
ELMo/README.md
浏览文件 @
4650e959
...
@@ -20,7 +20,7 @@ ELMo(Embeddings from Language Models) 是重要的通用语义表示模型之一
...
@@ -20,7 +20,7 @@ ELMo(Embeddings from Language Models) 是重要的通用语义表示模型之一
| Task | 评估指标 | Baseline | +ELMo |
| Task | 评估指标 | Baseline | +ELMo |
| :------| :------: | :------: |:------: |
| :------| :------: | :------: |:------: |
|
[
LAC
](
https://github.com/baidu/lac
)
| F1 | 87.3% |
**88.4%**
|
|
[
LAC
](
https://github.com/baidu/lac
)
| F1 | 87.3% |
**88.4%**
|
|
[
阅读理解
](
github.com/PaddlePaddle/models/tree/develop/PaddleNLP
/machine_reading_comprehension
)
| Rouge-L | 39.4% |
**40.4%**
|
|
[
阅读理解
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleNLP/unarchived
/machine_reading_comprehension
)
| Rouge-L | 39.4% |
**40.4%**
|
**Note**
:
**Note**
:
...
...
ELMo/train.py
浏览文件 @
4650e959
...
@@ -555,6 +555,7 @@ def train_loop(args,
...
@@ -555,6 +555,7 @@ def train_loop(args,
valid_ppl
=
eval
(
vocab
,
infer_progs
,
dev_count
,
logger
,
args
)
valid_ppl
=
eval
(
vocab
,
infer_progs
,
dev_count
,
logger
,
args
)
logger
.
info
(
"valid ppl {}"
.
format
(
valid_ppl
))
logger
.
info
(
"valid ppl {}"
.
format
(
valid_ppl
))
if
batch_id
>
0
and
batch_id
%
args
.
save_interval
==
0
:
if
batch_id
>
0
and
batch_id
%
args
.
save_interval
==
0
:
epoch_id
=
int
(
batch_id
/
n_batches_per_epoch
)
model_path
=
os
.
path
.
join
(
args
.
para_save_dir
,
model_path
=
os
.
path
.
join
(
args
.
para_save_dir
,
str
(
batch_id
+
epoch_id
))
str
(
batch_id
+
epoch_id
))
if
not
os
.
path
.
isdir
(
model_path
):
if
not
os
.
path
.
isdir
(
model_path
):
...
...
ERNIE/finetune/classifier.py
浏览文件 @
4650e959
...
@@ -156,7 +156,7 @@ def evaluate(exe, test_program, test_pyreader, graph_vars, eval_phase):
...
@@ -156,7 +156,7 @@ def evaluate(exe, test_program, test_pyreader, graph_vars, eval_phase):
outputs
=
exe
.
run
(
fetch_list
=
train_fetch_list
)
outputs
=
exe
.
run
(
fetch_list
=
train_fetch_list
)
ret
=
{
"loss"
:
np
.
mean
(
outputs
[
0
]),
"accuracy"
:
np
.
mean
(
outputs
[
1
])}
ret
=
{
"loss"
:
np
.
mean
(
outputs
[
0
]),
"accuracy"
:
np
.
mean
(
outputs
[
1
])}
if
"learning_rate"
in
graph_vars
:
if
"learning_rate"
in
graph_vars
:
ret
[
"learning_rate"
]
=
float
(
outputs
[
4
][
0
])
ret
[
"learning_rate"
]
=
float
(
outputs
[
3
][
0
])
return
ret
return
ret
test_pyreader
.
start
()
test_pyreader
.
start
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录