Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
5744ddb8
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看板
未验证
提交
5744ddb8
编写于
10月 30, 2019
作者:
X
Xiaoyao Xi
提交者:
GitHub
10月 30, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16 from xixiaoyao/master
fix bugs
上级
20f241fa
42f9ba10
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
16 deletion
+13
-16
config_demo2.yaml
config_demo2.yaml
+4
-4
paddlepalm/task_paradigm/mlm.py
paddlepalm/task_paradigm/mlm.py
+4
-9
paddlepalm/task_paradigm/mrc.py
paddlepalm/task_paradigm/mrc.py
+5
-3
未找到文件。
config_demo2.yaml
浏览文件 @
5744ddb8
task_instance
:
"
mrqa,
match4mrqa"
target_tag
:
1,
0
mix_ratio
:
0.5,
0.5
task_instance
:
"
mrqa,
m
lm4mrqa,
m
atch4mrqa"
target_tag
:
1, 0
,
0
mix_ratio
:
0.5,
1.0,
0.5
save_path
:
"
output_model/secondrun"
...
...
@@ -12,7 +12,7 @@ do_lower_case: True
max_seq_len
:
512
batch_size
:
4
num_epochs
:
0.5
num_epochs
:
2
optimizer
:
"
adam"
learning_rate
:
3e-5
warmup_proportion
:
0.1
...
...
paddlepalm/task_paradigm/mlm.py
浏览文件 @
5744ddb8
...
...
@@ -51,12 +51,14 @@ class TaskParadigm(task_paradigm):
return
{
"logits"
:
[[
-
1
],
'float32'
]}
def
build
(
self
,
inputs
):
mask_pos
=
inputs
[
"reader"
][
"mask_pos"
]
if
self
.
_is_training
:
mask_label
=
inputs
[
"reader"
][
"mask_label"
]
# 多任务学习时才需要引入这个,防止其他run其他任务时导致seqlen过小,gather超范围
batchsize_x_seqlen
=
inputs
[
"reader"
][
"batchsize_x_seqlen"
]
max_position
=
inputs
[
"reader"
][
"batchsize_x_seqlen"
]
-
1
mask_pos
=
fluid
.
layers
.
elementwise_min
(
mask_pos
,
max_position
)
mask_pos
.
stop_gradient
=
True
mask_pos
=
inputs
[
"reader"
][
"mask_pos"
]
word_emb
=
inputs
[
"backbone"
][
"embedding_table"
]
enc_out
=
inputs
[
"backbone"
][
"encoder_outputs"
]
...
...
@@ -65,13 +67,6 @@ class TaskParadigm(task_paradigm):
_param_initializer
=
fluid
.
initializer
.
TruncatedNormal
(
scale
=
self
.
_initializer_range
)
if
self
.
_is_training
:
# 多任务训练时才需要引入这个,防止其他run其他任务时导致seqlen过小,gather超范围
# mask_pos = fluid.layers.cast(x=mask_pos, dtype='int32')
mask_pos
=
fluid
.
layers
.
elementwise_min
(
mask_pos
,
batchsize_x_seqlen
)
#print(fluid.default_main_program().blocks[0].vars)
reshaped_emb_out
=
fluid
.
layers
.
reshape
(
x
=
enc_out
,
shape
=
[
-
1
,
emb_size
])
...
...
paddlepalm/task_paradigm/mrc.py
浏览文件 @
5744ddb8
...
...
@@ -77,9 +77,11 @@ class TaskParadigm(task_paradigm):
if
self
.
_is_training
:
start_positions
=
inputs
[
'reader'
][
'start_positions'
]
end_positions
=
inputs
[
'reader'
][
'end_positions'
]
seqlen
=
inputs
[
"reader"
][
"seqlen"
]
start_positions
=
fluid
.
layers
.
elementwise_min
(
start_positions
,
seqlen
)
end_positions
=
fluid
.
layers
.
elementwise_min
(
end_positions
,
seqlen
)
max_position
=
inputs
[
"reader"
][
"seqlen"
]
-
1
start_positions
=
fluid
.
layers
.
elementwise_min
(
start_positions
,
max_position
)
end_positions
=
fluid
.
layers
.
elementwise_min
(
end_positions
,
max_position
)
start_positions
.
stop_gradient
=
True
end_positions
.
stop_gradient
=
True
else
:
unique_id
=
inputs
[
'reader'
][
'unique_ids'
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录