Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
58e7a556
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
7
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看板
提交
58e7a556
编写于
12月 04, 2019
作者:
W
wangxiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cross_entropy
上级
c087d295
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
11 deletion
+10
-11
paddlepalm/task_paradigm/cls.py
paddlepalm/task_paradigm/cls.py
+2
-2
paddlepalm/task_paradigm/match.py
paddlepalm/task_paradigm/match.py
+2
-2
paddlepalm/task_paradigm/mlm.py
paddlepalm/task_paradigm/mlm.py
+2
-2
paddlepalm/task_paradigm/mrc.py
paddlepalm/task_paradigm/mrc.py
+4
-3
paddlepalm/utils/reader_helper.py
paddlepalm/utils/reader_helper.py
+0
-2
未找到文件。
paddlepalm/task_paradigm/cls.py
浏览文件 @
58e7a556
...
...
@@ -75,8 +75,8 @@ class TaskParadigm(task_paradigm):
name
=
scope_name
+
"cls_out_b"
,
initializer
=
fluid
.
initializer
.
Constant
(
0.
)))
if
self
.
_is_training
:
loss
=
fluid
.
layers
.
softmax_with_
cross_entropy
(
logits
=
logits
,
label
=
label_ids
)
loss
=
fluid
.
layers
.
cross_entropy
(
input
=
logits
,
label
=
label_ids
)
loss
=
layers
.
mean
(
loss
)
return
{
"loss"
:
loss
}
else
:
...
...
paddlepalm/task_paradigm/match.py
浏览文件 @
58e7a556
...
...
@@ -79,8 +79,8 @@ class TaskParadigm(task_paradigm):
initializer
=
fluid
.
initializer
.
Constant
(
0.
)))
if
self
.
_is_training
:
ce_loss
,
probs
=
fluid
.
layers
.
softmax_with_
cross_entropy
(
logits
=
logits
,
label
=
labels
,
return_softmax
=
True
)
ce_loss
,
probs
=
fluid
.
layers
.
cross_entropy
(
input
=
logits
,
label
=
labels
,
return_softmax
=
True
)
loss
=
fluid
.
layers
.
mean
(
x
=
ce_loss
)
return
{
'loss'
:
loss
}
else
:
...
...
paddlepalm/task_paradigm/mlm.py
浏览文件 @
58e7a556
...
...
@@ -100,8 +100,8 @@ class TaskParadigm(task_paradigm):
is_bias
=
True
)
if
self
.
_is_training
:
mask_lm_loss
=
fluid
.
layers
.
softmax_with_
cross_entropy
(
logits
=
fc_out
,
label
=
mask_label
)
mask_lm_loss
=
fluid
.
layers
.
cross_entropy
(
input
=
fc_out
,
label
=
mask_label
)
loss
=
fluid
.
layers
.
mean
(
mask_lm_loss
)
return
{
'loss'
:
loss
}
else
:
...
...
paddlepalm/task_paradigm/mrc.py
浏览文件 @
58e7a556
...
...
@@ -100,9 +100,10 @@ class TaskParadigm(task_paradigm):
start_logits
,
end_logits
=
fluid
.
layers
.
unstack
(
x
=
logits
,
axis
=
0
)
def
_compute_single_loss
(
logits
,
positions
):
"""Compute start/end loss for mrc model"""
loss
=
fluid
.
layers
.
softmax_with_cross_entropy
(
logits
=
logits
,
label
=
positions
)
"""Compute start/en
d loss for mrc model"""
loss
=
fluid
.
layers
.
cross_entropy
(
input
=
logits
,
label
=
positions
)
loss
=
fluid
.
layers
.
mean
(
x
=
loss
)
return
loss
...
...
paddlepalm/utils/reader_helper.py
浏览文件 @
58e7a556
...
...
@@ -22,8 +22,6 @@ 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录