Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PALM
提交
1941c278
P
PALM
项目概览
PaddlePaddle
/
PALM
通知
5
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看板
提交
1941c278
编写于
11月 29, 2019
作者:
W
wangxiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change name & path
上级
2f34f935
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
25 addition
and
25 deletion
+25
-25
.gitignore
.gitignore
+1
-1
README.md
README.md
+9
-9
demo/demo1/config.yaml
demo/demo1/config.yaml
+2
-2
demo/demo1/mrqa.yaml
demo/demo1/mrqa.yaml
+1
-1
demo/demo2/config.yaml
demo/demo2/config.yaml
+4
-4
demo/demo3/config.yaml
demo/demo3/config.yaml
+3
-3
paddlepalm/mtl_controller.py
paddlepalm/mtl_controller.py
+5
-5
未找到文件。
.gitignore
浏览文件 @
1941c278
*.pyc
__pycache__
pretrain
_model
pretrain
output_model
build
dist
...
...
README.md
浏览文件 @
1941c278
...
...
@@ -163,7 +163,7 @@ max_seq_len: 512
max_query_len
:
64
doc_stride
:
128
# 在MRQA数据集中,存在较长的文档,因此我们这里使用滑动窗口处理样本,滑动步长设置为128
do_lower_case
:
True
vocab_path
:
"
../../pretrain
_model/bert
/vocab.txt"
vocab_path
:
"
../../pretrain
/bert-en-uncased-large
/vocab.txt"
```
更详细的任务实例配置方法(为任务实例选择合适的reader、paradigm和backbone)可参考
[
这里
](
#readerbackbone与paradigm的选择
)
...
...
@@ -178,7 +178,7 @@ task_instance: "mrqa"
save_path
:
"
output_model/firstrun"
backbone
:
"
bert"
backbone_config_path
:
"
../../pretrain
_model/bert
/bert_config.json"
backbone_config_path
:
"
../../pretrain
/bert-en-uncased-large
/bert_config.json"
optimizer
:
"
adam"
learning_rate
:
3e-5
...
...
@@ -204,7 +204,7 @@ import paddlepalm as palm
if
__name__
==
'__main__'
:
controller
=
palm
.
Controller
(
'config.yaml'
)
controller
.
load_pretrain
(
'../../pretrain
_model/bert
/params'
)
controller
.
load_pretrain
(
'../../pretrain
/bert-en-uncased-large
/params'
)
controller
.
train
()
```
...
...
@@ -271,9 +271,9 @@ target_tag: 1,0,0
save_path
:
"
output_model/secondrun"
backbone
:
"
ernie"
backbone_config_path
:
"
../../pretrain
_model/erni
e/ernie_config.json"
backbone_config_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/ernie_config.json"
vocab_path
:
"
../../pretrain
_model/erni
e/vocab.txt"
vocab_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/vocab.txt"
do_lower_case
:
True
max_seq_len
:
512
# 写入全局配置文件的参数会被自动广播到各个任务实例
...
...
@@ -308,7 +308,7 @@ import paddlepalm as palm
if
__name__
==
'__main__'
:
controller
=
palm
.
Controller
(
'config.yaml'
,
task_dir
=
'tasks'
)
controller
.
load_pretrain
(
'../../pretrain
_model/erni
e/params'
)
controller
.
load_pretrain
(
'../../pretrain
/ernie-en-uncased-larg
e/params'
)
controller
.
train
()
```
...
...
@@ -400,9 +400,9 @@ task_reuse_tag: 0, 0, 1, 1, 0, 2
save_path
:
"
output_model/secondrun"
backbone
:
"
ernie"
backbone_config_path
:
"
../../pretrain
_model/erni
e/ernie_config.json"
backbone_config_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/ernie_config.json"
vocab_path
:
"
../../pretrain
_model/erni
e/vocab.txt"
vocab_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/vocab.txt"
do_lower_case
:
True
max_seq_len
:
512
# 写入全局配置文件的参数会被自动广播到各个任务实例
...
...
@@ -422,7 +422,7 @@ import paddlepalm as palm
if __name__ == '__main__'
:
controller = palm.Controller('config.yaml', task_dir='tasks')
controller.load_pretrain('../../pretrain
_model/erni
e/params')
controller.load_pretrain('../../pretrain
/ernie-en-uncased-larg
e/params')
controller.train()
```
...
...
demo/demo1/config.yaml
浏览文件 @
1941c278
...
...
@@ -2,8 +2,8 @@ task_instance: "mrqa"
save_path
:
"
output_model/firstrun"
backbone
:
"
bert"
backbone_config_path
:
"
../../pretrain
_model/bert
/bert_config.json"
backbone
:
"
bert
-en-uncased-large
"
backbone_config_path
:
"
../../pretrain
/bert-en-uncased-large
/bert_config.json"
batch_size
:
4
num_epochs
:
2
...
...
demo/demo1/mrqa.yaml
浏览文件 @
1941c278
...
...
@@ -2,7 +2,7 @@ train_file: data/mrqa/train.json
reader
:
mrc
paradigm
:
mrc
vocab_path
:
"
../../pretrain
_model/bert
/vocab.txt"
vocab_path
:
"
../../pretrain
/bert-en-uncased-large
/vocab.txt"
do_lower_case
:
True
max_seq_len
:
512
doc_stride
:
128
...
...
demo/demo2/config.yaml
浏览文件 @
1941c278
...
...
@@ -4,15 +4,15 @@ mix_ratio: 1.0, 0.5, 0.5
save_path
:
"
output_model/secondrun"
backbone
:
"
ernie"
backbone_config_path
:
"
../../pretrain
_model/erni
e/ernie_config.json"
backbone
:
"
ernie
-en-uncased-large
"
backbone_config_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/ernie_config.json"
vocab_path
:
"
../../pretrain
_model/erni
e/vocab.txt"
vocab_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/vocab.txt"
do_lower_case
:
True
max_seq_len
:
512
batch_size
:
4
num_epochs
:
2
num_epochs
:
0.1
optimizer
:
"
adam"
learning_rate
:
3e-5
warmup_proportion
:
0.1
...
...
demo/demo3/config.yaml
浏览文件 @
1941c278
...
...
@@ -4,10 +4,10 @@ task_reuse_tag: 0,0,1,1,0,2
save_path
:
"
output_model/thirdrun"
backbone
:
"
ernie"
backbone_config_path
:
"
../../pretrain
_model/erni
e/ernie_config.json"
backbone
:
"
ernie
-en-uncased-large
"
backbone_config_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/ernie_config.json"
vocab_path
:
"
../../pretrain
_model/erni
e/vocab.txt"
vocab_path
:
"
../../pretrain
/ernie-en-uncased-larg
e/vocab.txt"
do_lower_case
:
True
max_seq_len
:
512
...
...
paddlepalm/mtl_controller.py
浏览文件 @
1941c278
...
...
@@ -522,15 +522,15 @@ class Controller(object):
inst
.
reader
[
'pred'
]
=
pred_reader
return
pred_prog
def
load_pretrain
(
self
,
pretrain_
model_
path
=
None
):
def
load_pretrain
(
self
,
pretrain_path
=
None
):
# load pretrain model (or ckpt)
if
pretrain_
model_
path
is
None
:
assert
'pretrain_
model_path'
in
self
.
main_conf
,
"pretrain_model
_path NOT set."
pretrain_
model_path
=
self
.
main_conf
[
'pretrain_model
_path'
]
if
pretrain_path
is
None
:
assert
'pretrain_
path'
in
self
.
main_conf
,
"pretrain
_path NOT set."
pretrain_
path
=
self
.
main_conf
[
'pretrain
_path'
]
init_pretraining_params
(
self
.
exe
,
pretrain_
model_
path
,
pretrain_path
,
main_program
=
fluid
.
default_startup_program
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录