Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
c087d295
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看板
提交
c087d295
编写于
12月 04, 2019
作者:
W
wangxiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bugs
上级
1a762548
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
21 addition
and
19 deletion
+21
-19
paddlepalm/backbone/bert.py
paddlepalm/backbone/bert.py
+1
-1
paddlepalm/backbone/ernie.py
paddlepalm/backbone/ernie.py
+1
-1
paddlepalm/reader/cls.py
paddlepalm/reader/cls.py
+3
-3
paddlepalm/reader/match.py
paddlepalm/reader/match.py
+3
-3
paddlepalm/reader/mlm.py
paddlepalm/reader/mlm.py
+3
-3
paddlepalm/reader/mrc.py
paddlepalm/reader/mrc.py
+2
-2
paddlepalm/task_paradigm/cls.py
paddlepalm/task_paradigm/cls.py
+1
-1
paddlepalm/task_paradigm/match.py
paddlepalm/task_paradigm/match.py
+1
-1
paddlepalm/task_paradigm/mlm.py
paddlepalm/task_paradigm/mlm.py
+2
-2
paddlepalm/task_paradigm/mrc.py
paddlepalm/task_paradigm/mrc.py
+2
-2
paddlepalm/utils/reader_helper.py
paddlepalm/utils/reader_helper.py
+2
-0
未找到文件。
paddlepalm/backbone/bert.py
浏览文件 @
c087d295
...
...
@@ -55,7 +55,7 @@ class Model(backbone):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
]}
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
]}
@
property
def
outputs_attr
(
self
):
...
...
paddlepalm/backbone/ernie.py
浏览文件 @
c087d295
...
...
@@ -65,7 +65,7 @@ class Model(backbone):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
]}
@
property
...
...
paddlepalm/reader/cls.py
浏览文件 @
c087d295
...
...
@@ -65,8 +65,8 @@ class Reader(reader):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"label_ids"
:
[[
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"label_ids"
:
[[
-
1
,
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
]
}
else
:
...
...
@@ -74,7 +74,7 @@ class Reader(reader):
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
]
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
]
}
...
...
paddlepalm/reader/match.py
浏览文件 @
c087d295
...
...
@@ -63,8 +63,8 @@ class Reader(reader):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"label_ids"
:
[[
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"label_ids"
:
[[
-
1
,
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
]
}
else
:
...
...
@@ -72,7 +72,7 @@ class Reader(reader):
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
]
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
]
}
...
...
paddlepalm/reader/mlm.py
浏览文件 @
c087d295
...
...
@@ -63,10 +63,10 @@ class Reader(reader):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"mask_label"
:
[[
-
1
],
'int64'
],
"mask_pos"
:
[[
-
1
],
'int64'
],
"mask_label"
:
[[
-
1
,
1
],
'int64'
],
"mask_pos"
:
[[
-
1
,
1
],
'int64'
],
}
...
...
paddlepalm/reader/mrc.py
浏览文件 @
c087d295
...
...
@@ -71,7 +71,7 @@ class Reader(reader):
return
{
"token_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"start_positions"
:
[[
-
1
],
'int64'
],
"end_positions"
:
[[
-
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
]
...
...
@@ -81,7 +81,7 @@ class Reader(reader):
"position_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"segment_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"task_ids"
:
[[
-
1
,
-
1
],
'int64'
],
"input_mask"
:
[[
-
1
,
-
1
],
'float32'
],
"input_mask"
:
[[
-
1
,
-
1
,
1
],
'float32'
],
"unique_ids"
:
[[
-
1
],
'int64'
]
}
...
...
paddlepalm/task_paradigm/cls.py
浏览文件 @
c087d295
...
...
@@ -43,7 +43,7 @@ class TaskParadigm(task_paradigm):
@
property
def
inputs_attrs
(
self
):
if
self
.
_is_training
:
reader
=
{
"label_ids"
:
[[
-
1
],
'int64'
]}
reader
=
{
"label_ids"
:
[[
-
1
,
1
],
'int64'
]}
else
:
reader
=
{}
bb
=
{
"sentence_embedding"
:
[[
-
1
,
self
.
_hidden_size
],
'float32'
]}
...
...
paddlepalm/task_paradigm/match.py
浏览文件 @
c087d295
...
...
@@ -44,7 +44,7 @@ class TaskParadigm(task_paradigm):
@
property
def
inputs_attrs
(
self
):
if
self
.
_is_training
:
reader
=
{
"label_ids"
:
[[
-
1
],
'int64'
]}
reader
=
{
"label_ids"
:
[[
-
1
,
1
],
'int64'
]}
else
:
reader
=
{}
bb
=
{
"sentence_pair_embedding"
:
[[
-
1
,
self
.
_hidden_size
],
'float32'
]}
...
...
paddlepalm/task_paradigm/mlm.py
浏览文件 @
c087d295
...
...
@@ -33,8 +33,8 @@ class TaskParadigm(task_paradigm):
@
property
def
inputs_attrs
(
self
):
reader
=
{
"mask_label"
:
[[
-
1
],
'int64'
],
"mask_pos"
:
[[
-
1
],
'int64'
]}
"mask_label"
:
[[
-
1
,
1
],
'int64'
],
"mask_pos"
:
[[
-
1
,
1
],
'int64'
]}
if
not
self
.
_is_training
:
del
reader
[
'mask_label'
]
del
reader
[
'batchsize_x_seqlen'
]
...
...
paddlepalm/task_paradigm/mrc.py
浏览文件 @
c087d295
...
...
@@ -68,8 +68,8 @@ class TaskParadigm(task_paradigm):
if
self
.
_is_training
:
return
{
'loss'
:
[[
1
],
'float32'
]}
else
:
return
{
'start_logits'
:
[[
-
1
,
-
1
],
'float32'
],
'end_logits'
:
[[
-
1
,
-
1
],
'float32'
],
return
{
'start_logits'
:
[[
-
1
,
-
1
,
1
],
'float32'
],
'end_logits'
:
[[
-
1
,
-
1
,
1
],
'float32'
],
'unique_ids'
:
[[
-
1
],
'int64'
]}
...
...
paddlepalm/utils/reader_helper.py
浏览文件 @
c087d295
...
...
@@ -22,6 +22,8 @@ from paddle import fluid
def
_check_and_adapt_shape_dtype
(
rt_val
,
attr
,
message
=
""
):
print
(
rt_val
)
print
(
attr
)
if
not
isinstance
(
rt_val
,
np
.
ndarray
):
rt_val
=
np
.
array
(
rt_val
)
assert
rt_val
.
dtype
!=
np
.
dtype
(
'O'
),
"yielded data is not a valid tensor(number of elements on some dimension may differ)."
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录