Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
c00b77fe
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
4
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看板
未验证
提交
c00b77fe
编写于
3月 18, 2020
作者:
X
Xiaoyao Xi
提交者:
GitHub
3月 18, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #72 from wangxiao1021/api
fix
#68
#71
and other bugs
上级
6a44ce57
ad304672
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
12 addition
and
18 deletion
+12
-18
README_zh.md
README_zh.md
+6
-6
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
浏览文件 @
c00b77fe
...
...
@@ -4,7 +4,7 @@
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"
>
<img
src=
"https://tva1.sinaimg.cn/large/006tNbRwly1gbjkuuwrmlj30hs0hzdh2.jpg"
alt=
"Sample"
width=
"300"
height=
"333"
>
...
...
@@ -196,10 +196,10 @@ Available pretrain items:
更多实现细节请见示例:
-
[
Sentiment Classification
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/classification
)
-
[
Quora
Question Pairs matching
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/matching
)
-
[
Tagging
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/tagging
)
-
[
SQuAD machine Reading Comprehension
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/mrc
)
.
-
[
情感分析
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/classification
)
-
[
Quora
问题相似度匹配
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/matching
)
-
[
命名实体识别
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/tagging
)
-
[
类SQuAD机器阅读理解
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/mrc
)
#### 多任务学习
...
...
@@ -218,7 +218,7 @@ multi_head_trainer的保存/加载和预测操作与trainer相同。
更多实现
`multi_head_trainer`
的细节,请见
-
[
ATIS:
joint training of dialogue intent recognition and slot filling
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/multi-task
)
-
[
ATIS:
对话意图识别和插槽填充的联合训练
](
https://github.com/PaddlePaddle/PALM/tree/master/examples/multi-task
)
#### 设置saver
...
...
examples/classification/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
examples/matching/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
examples/mrc/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
examples/multi-task/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
@@ -80,4 +79,4 @@ if __name__ == '__main__':
# save_steps = 10
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
# step 8-3: start training
trainer
.
train
(
print_steps
=
print_steps
)
\ No newline at end of file
trainer
.
train
(
print_steps
=
print_steps
)
examples/predict/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
examples/tagging/run.py
浏览文件 @
c00b77fe
# coding=utf-8
import
paddlepalm
as
palm
import
json
from
paddlepalm.distribute
import
gpu_dev_count
if
__name__
==
'__main__'
:
...
...
@@ -64,9 +63,9 @@ if __name__ == '__main__':
# step 7: fit prepared reader and data
trainer
.
fit_reader
(
seq_label_reader
)
#
#
step 8-1*: load pretrained parameters
# step 8-1*: load pretrained parameters
trainer
.
load_pretrain
(
pre_params
)
#
#
step 8-2*: set saver to save model
# step 8-2*: set saver to save model
save_steps
=
1951
# print('save_steps: {}'.format(save_steps))
trainer
.
set_saver
(
save_path
=
save_path
,
save_steps
=
save_steps
,
save_type
=
save_type
)
...
...
paddlepalm/head/cls.py
浏览文件 @
c00b77fe
...
...
@@ -98,7 +98,7 @@ class Classify(Head):
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
:
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
=
json
.
dumps
(
result
)
writer
.
write
(
result
+
'
\n
'
)
...
...
paddlepalm/head/match.py
浏览文件 @
c00b77fe
...
...
@@ -179,7 +179,7 @@ class Match(Head):
with
open
(
os
.
path
.
join
(
output_dir
,
'predictions.json'
),
'w'
)
as
writer
:
for
i
in
range
(
len
(
self
.
_preds
)):
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
]}
elif
self
.
_learning_strategy
==
'pairwise'
:
result
=
{
'index'
:
i
,
'probs'
:
self
.
_preds
[
i
][
0
]}
...
...
paddlepalm/reader/utils/reader4ernie.py
浏览文件 @
c00b77fe
...
...
@@ -37,7 +37,7 @@ from paddlepalm.reader.utils.mlm_batching import prepare_batch_data
log
=
logging
.
getLogger
(
__name__
)
if
six
.
PY3
:
if
six
.
PY3
and
hasattr
(
sys
.
stdout
,
'buffer'
)
:
import
io
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录