Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
c1e8179f
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
5
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PALM
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c1e8179f
编写于
3月 18, 2020
作者:
W
wangxiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
#68
#71
and other bugs
上级
20b8873c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
10 addition
and
16 deletion
+10
-16
README_zh.md
README_zh.md
+4
-4
examples/classification/run.py
examples/classification/run.py
+0
-1
examples/matching/run.py
examples/matching/run.py
+0
-1
examples/mrc/run.py
examples/mrc/run.py
+0
-1
examples/multi-task/run.py
examples/multi-task/run.py
+1
-2
examples/predict/run.py
examples/predict/run.py
+0
-1
examples/tagging/run.py
examples/tagging/run.py
+2
-3
paddlepalm/head/cls.py
paddlepalm/head/cls.py
+1
-1
paddlepalm/head/match.py
paddlepalm/head/match.py
+1
-1
paddlepalm/reader/utils/reader4ernie.py
paddlepalm/reader/utils/reader4ernie.py
+1
-1
未找到文件。
README_zh.md
浏览文件 @
c1e8179f
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
PaddlePALM (PArallel Learning from Multi-tasks) 是一个灵活,通用且易于使用的NLP大规模预训练和多任务学习框架。 PALM是一个旨在
**快速开发高性能NLP模型**
的上层框架。
PaddlePALM (PArallel Learning from Multi-tasks) 是一个灵活,通用且易于使用的NLP大规模预训练和多任务学习框架。 PALM是一个旨在
**快速开发高性能NLP模型**
的上层框架。
使用PaddlePALM,可以非常轻松灵活的探索具有多种任务辅助训练的“高鲁棒性”阅读理解模型,基于PALM训练的模型
[
D-Net
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleNLP/Research/MRQA2019-D-NET
)
在
[
EMNLP2019国际阅读理解评测
](
mrqa
.github.io
)中夺得冠军。
使用PaddlePALM,可以非常轻松灵活的探索具有多种任务辅助训练的“高鲁棒性”阅读理解模型,基于PALM训练的模型
[
D-Net
](
https://github.com/PaddlePaddle/models/tree/develop/PaddleNLP/Research/MRQA2019-D-NET
)
在
[
EMNLP2019国际阅读理解评测
](
https://mrqa.github.io/
)
中夺得冠军。
<p
align=
"center"
>
<p
align=
"center"
>
<img
src=
"https://tva1.sinaimg.cn/large/006tNbRwly1gbjkuuwrmlj30hs0hzdh2.jpg"
alt=
"Sample"
width=
"300"
height=
"333"
>
<img
src=
"https://tva1.sinaimg.cn/large/006tNbRwly1gbjkuuwrmlj30hs0hzdh2.jpg"
alt=
"Sample"
width=
"300"
height=
"333"
>
...
@@ -197,9 +197,9 @@ Available pretrain items:
...
@@ -197,9 +197,9 @@ Available pretrain items:
更多实现细节请见示例:
更多实现细节请见示例:
-
[
Sentiment Classification
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/classification
)
-
[
Sentiment Classification
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/classification
)
-
[
Qu
ora Qu
estion Pairs matching
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/matching
)
-
[
Question Pairs matching
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/matching
)
-
[
Tagging
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/tagging
)
-
[
Named Entity Recognition
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/tagging
)
-
[
SQuAD
m
achine Reading Comprehension
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/mrc
)
.
-
[
SQuAD
-like M
achine Reading Comprehension
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/mrc
)
.
#### 多任务学习
#### 多任务学习
...
...
examples/classification/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
examples/matching/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
examples/mrc/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
examples/multi-task/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -80,4 +79,4 @@ if __name__ == '__main__':
...
@@ -80,4 +79,4 @@ if __name__ == '__main__':
# save_steps = 10
# save_steps = 10
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
# step 8-3: start training
# step 8-3: start training
trainer
.
train
(
print_steps
=
print_steps
)
trainer
.
train
(
print_steps
=
print_steps
)
\ No newline at end of file
examples/predict/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
examples/tagging/run.py
浏览文件 @
c1e8179f
# coding=utf-8
# coding=utf-8
import
paddlepalm
as
palm
import
paddlepalm
as
palm
import
json
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
@@ -64,9 +63,9 @@ if __name__ == '__main__':
...
@@ -64,9 +63,9 @@ if __name__ == '__main__':
# step 7: fit prepared reader and data
# step 7: fit prepared reader and data
trainer
.
fit_reader
(
seq_label_reader
)
trainer
.
fit_reader
(
seq_label_reader
)
#
#
step 8-1*: load pretrained parameters
# step 8-1*: load pretrained parameters
trainer
.
load_pretrain
(
pre_params
)
trainer
.
load_pretrain
(
pre_params
)
#
#
step 8-2*: set saver to save model
# step 8-2*: set saver to save model
save_steps
=
1951
save_steps
=
1951
# print('save_steps: {}'.format(save_steps))
# print('save_steps: {}'.format(save_steps))
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
...
...
paddlepalm/head/cls.py
浏览文件 @
c1e8179f
...
@@ -98,7 +98,7 @@ class Classify(Head):
...
@@ -98,7 +98,7 @@ class Classify(Head):
raise
ValueError
(
'argument output_dir not found in config. Please add it into config dict/file.'
)
raise
ValueError
(
'argument output_dir not found in config. Please add it into config dict/file.'
)
with
open
(
os
.
path
.
join
(
output_dir
,
'predictions.json'
),
'w'
)
as
writer
:
with
open
(
os
.
path
.
join
(
output_dir
,
'predictions.json'
),
'w'
)
as
writer
:
for
i
in
range
(
len
(
self
.
_preds
)):
for
i
in
range
(
len
(
self
.
_preds
)):
label
=
np
.
argmax
(
np
.
array
(
self
.
_preds
[
i
]
))
label
=
int
(
np
.
argmax
(
np
.
array
(
self
.
_preds
[
i
])
))
result
=
{
'index'
:
i
,
'label'
:
label
,
'logits'
:
self
.
_preds
[
i
],
'probs'
:
self
.
_probs
[
i
]}
result
=
{
'index'
:
i
,
'label'
:
label
,
'logits'
:
self
.
_preds
[
i
],
'probs'
:
self
.
_probs
[
i
]}
result
=
json
.
dumps
(
result
)
result
=
json
.
dumps
(
result
)
writer
.
write
(
result
+
'
\n
'
)
writer
.
write
(
result
+
'
\n
'
)
...
...
paddlepalm/head/match.py
浏览文件 @
c1e8179f
...
@@ -179,7 +179,7 @@ class Match(Head):
...
@@ -179,7 +179,7 @@ class Match(Head):
with
open
(
os
.
path
.
join
(
output_dir
,
'predictions.json'
),
'w'
)
as
writer
:
with
open
(
os
.
path
.
join
(
output_dir
,
'predictions.json'
),
'w'
)
as
writer
:
for
i
in
range
(
len
(
self
.
_preds
)):
for
i
in
range
(
len
(
self
.
_preds
)):
if
self
.
_learning_strategy
==
'pointwise'
:
if
self
.
_learning_strategy
==
'pointwise'
:
label
=
np
.
argmax
(
np
.
array
(
self
.
_preds
[
i
]
))
label
=
int
(
np
.
argmax
(
np
.
array
(
self
.
_preds
[
i
])
))
result
=
{
'index'
:
i
,
'label'
:
label
,
'logits'
:
self
.
_preds_logits
[
i
],
'probs'
:
self
.
_preds
[
i
]}
result
=
{
'index'
:
i
,
'label'
:
label
,
'logits'
:
self
.
_preds_logits
[
i
],
'probs'
:
self
.
_preds
[
i
]}
elif
self
.
_learning_strategy
==
'pairwise'
:
elif
self
.
_learning_strategy
==
'pairwise'
:
result
=
{
'index'
:
i
,
'probs'
:
self
.
_preds
[
i
][
0
]}
result
=
{
'index'
:
i
,
'probs'
:
self
.
_preds
[
i
][
0
]}
...
...
paddlepalm/reader/utils/reader4ernie.py
浏览文件 @
c1e8179f
...
@@ -37,7 +37,7 @@ from paddlepalm.reader.utils.mlm_batching import prepare_batch_data
...
@@ -37,7 +37,7 @@ from paddlepalm.reader.utils.mlm_batching import prepare_batch_data
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
if
six
.
PY3
:
if
six
.
PY3
and
hasattr
(
sys
.
stdout
,
'buffer'
)
:
import
io
import
io
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf-8'
)
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf-8'
)
sys
.
stderr
=
io
.
TextIOWrapper
(
sys
.
stderr
.
buffer
,
encoding
=
'utf-8'
)
sys
.
stderr
=
io
.
TextIOWrapper
(
sys
.
stderr
.
buffer
,
encoding
=
'utf-8'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录