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