forked from PaddlePaddle/Paddle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
63 changed files
with
5,295 additions
and
4,981 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks.git | ||
sha: c25201a00e6b0514370501050cf2a8538ac12270 | ||
hooks: | ||
- id: remove-crlf | ||
- repo: https://github.com/reyoung/mirrors-yapf.git | ||
sha: v0.13.2 | ||
hooks: | ||
- id: yapf | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
sha: 4ef03c4223ad322c7adaa6c6c0efb26b57df3b71 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
# TODO(yuyang): trailing whitespace has some bugs on markdown | ||
# files now, please not add it to pre-commit hook now | ||
# - id: trailing-whitespace | ||
# | ||
# TODO(yuyang): debug-statements not fit for Paddle, because | ||
# not all of our python code is runnable. Some are used for | ||
# documenation | ||
# - id: debug-statements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
This folder contains scripts used in PaddlePaddle introduction. | ||
- use `bash train.sh` to train a simple linear regression model | ||
- use `python evaluate_model.py` to read model parameters. You can see that `w` and `b` are very close to [2, 0.3]. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,3 @@ done | |
cd $DIR | ||
rm -f *.list | ||
python generate_list.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ | |
"fields": ["id", "title", "genres"] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,3 @@ paddle train \ | |
--use_gpu=false \ | ||
--config_args=is_test=1 \ | ||
2>&1 | tee 'test.log' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,3 @@ paddle train \ | |
--show_parameter_stats_period=10 \ | ||
--test_all_data_in_one_period=1 \ | ||
2>&1 | tee 'train.log' | ||
|
366 changes: 183 additions & 183 deletions
366
doc/demo/semantic_role_labeling/semantic_role_labeling.md
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
========== | ||
Evaluators | ||
========== | ||
|
||
Base | ||
==== | ||
.. automodule:: paddle.trainer_config_helpers.evaluators | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Model Config Interface | ||
====================== | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
optimizers.rst | ||
data_sources.rst | ||
layers.rst | ||
activations.rst | ||
poolings.rst | ||
networks.rst | ||
evaluators.rst | ||
attrs.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
# 支持双层序列作为输入的Layer | ||
|
||
## 概述 | ||
|
||
在自然语言处理任务中,序列是一种常见的数据类型。一个独立的词语,可以看作是一个非序列输入,或者,我们称之为一个0层的序列;由词语构成的句子,是一个单层序列;若干个句子构成一个段落,是一个双层的序列。 | ||
|
||
双层序列是一个嵌套的序列,它的每一个元素,又是一个单层的序列。这是一种非常灵活的数据组织方式,帮助我们构造一些复杂的输入信息。 | ||
|
||
我们可以按照如下层次定义非序列,单层序列,以及双层序列。 | ||
|
||
+ 0层序列:一个独立的元素,类型可以是PaddlePaddle支持的任意输入数据类型 | ||
+ 单层序列:排成一列的多个元素,每个元素是一个0层序列,元素之间的顺序是重要的输入信息 | ||
+ 双层序列:排成一列的多个元素,每个元素是一个单层序列,称之为双层序列的一个子序列(subseq),subseq的每个元素是一个0层序列 | ||
|
||
|
||
在 PaddlePaddle中,下面这些Layer能够接受双层序列作为输入,完成相应的计算。 | ||
## pooling_layer | ||
|
||
pooling_layer的使用示例如下,详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#pooling-layer">配置API</a>。 | ||
```python | ||
seq_pool = pooling_layer(input=layer, | ||
pooling_type=AvgPooling(), | ||
agg_level=AggregateLevel.EACH_SEQUENCE) | ||
``` | ||
- `pooling_type` 目前支持两种,分别是:MaxPooling()和AvgPooling()。 | ||
- `agg_level=AggregateLevel.TIMESTEP`时(默认值): | ||
- 作用:双层序列经过运算变成一个0层序列,或单层序列经过运算变成一个0层序列 | ||
- 输入:一个双层序列,或一个单层序列 | ||
- 输出:一个0层序列,即整个输入序列(单层或双层)的平均值(或最大值) | ||
- `agg_level=AggregateLevel.EACH_SEQUENCE`时: | ||
- 作用:一个双层序列经过运算变成一个单层序列 | ||
- 输入:必须是一个双层序列 | ||
- 输出:一个单层序列,序列的每个元素是原来双层序列每个subseq元素的平均值(或最大值) | ||
|
||
## last_seq 和 first_seq | ||
|
||
last_seq的使用示例如下(first_seq类似),详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#last-seq">配置API</a>。 | ||
```python | ||
last = last_seq(input=layer, | ||
agg_level=AggregateLevel.EACH_SEQUENCE) | ||
``` | ||
- `agg_level=AggregateLevel.TIMESTEP`时(默认值): | ||
- 作用:一个双层序列经过运算变成一个0层序列,或一个单层序列经过运算变成一个0层序列 | ||
- 输入:一个双层序列或一个单层序列 | ||
- 输出:一个0层序列,即整个输入序列(双层或者单层)最后一个,或第一个元素。 | ||
- `agg_level=AggregateLevel.EACH_SEQUENCE`时: | ||
- 作用:一个双层序列经过运算变成一个单层序列 | ||
- 输入:必须是一个双层序列 | ||
- 输出:一个单层序列,其中每个元素是双层序列中每个subseq最后一个(或第一个)元素。 | ||
|
||
## expand_layer | ||
|
||
expand_layer的使用示例如下,详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#expand-layer">配置API</a>。 | ||
```python | ||
expand = expand_layer(input=layer1, | ||
expand_as=layer2, | ||
expand_level=ExpandLevel.FROM_TIMESTEP) | ||
``` | ||
- `expand_level=ExpandLevel.FROM_TIMESTEP`时(默认值): | ||
- 作用:一个0层序列经过运算扩展成一个单层序列,或者一个双层序列 | ||
- 输入:layer1必须是一个0层序列,是待扩展的数据;layer2可以是一个单层序列,或者是一个双层序列,提供扩展的长度信息 | ||
- 输出:一个单层序列,或一个双层序列,输出序列的类型(双层序列,或单层序列)和序列中含有元素的数目同 layer2一致。若输出是单层序列,单层序列的每个元素(0层序列),都是对layer1元素的拷贝;若输出是双层序列,双层序列每个subseq中每个元素(0层序列),都是对layer1元素的拷贝 | ||
- `expand_level=ExpandLevel.FROM_SEQUENCE`时: | ||
- 作用:一个单层序列经过运算扩展成一个双层序列 | ||
- 输入:layer1必须是一个单层序列,是待扩展的数据;layer2必须是一个双层序列,提供扩展的长度信息 | ||
- 输出:一个双层序列,序列中含有元素的数目同layer2一致。要求单层序列含有元素的数目(0层序列),和双层序列含有subseq 的数目一致。单层序列第i个元素(0层序列),被扩展为一个单层序列,构成了输出双层序列的第i个subseq。 | ||
# 支持双层序列作为输入的Layer | ||
|
||
## 概述 | ||
|
||
在自然语言处理任务中,序列是一种常见的数据类型。一个独立的词语,可以看作是一个非序列输入,或者,我们称之为一个0层的序列;由词语构成的句子,是一个单层序列;若干个句子构成一个段落,是一个双层的序列。 | ||
|
||
双层序列是一个嵌套的序列,它的每一个元素,又是一个单层的序列。这是一种非常灵活的数据组织方式,帮助我们构造一些复杂的输入信息。 | ||
|
||
我们可以按照如下层次定义非序列,单层序列,以及双层序列。 | ||
|
||
+ 0层序列:一个独立的元素,类型可以是PaddlePaddle支持的任意输入数据类型 | ||
+ 单层序列:排成一列的多个元素,每个元素是一个0层序列,元素之间的顺序是重要的输入信息 | ||
+ 双层序列:排成一列的多个元素,每个元素是一个单层序列,称之为双层序列的一个子序列(subseq),subseq的每个元素是一个0层序列 | ||
|
||
|
||
在 PaddlePaddle中,下面这些Layer能够接受双层序列作为输入,完成相应的计算。 | ||
## pooling_layer | ||
|
||
pooling_layer的使用示例如下,详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#pooling-layer">配置API</a>。 | ||
```python | ||
seq_pool = pooling_layer(input=layer, | ||
pooling_type=AvgPooling(), | ||
agg_level=AggregateLevel.EACH_SEQUENCE) | ||
``` | ||
- `pooling_type` 目前支持两种,分别是:MaxPooling()和AvgPooling()。 | ||
- `agg_level=AggregateLevel.TIMESTEP`时(默认值): | ||
- 作用:双层序列经过运算变成一个0层序列,或单层序列经过运算变成一个0层序列 | ||
- 输入:一个双层序列,或一个单层序列 | ||
- 输出:一个0层序列,即整个输入序列(单层或双层)的平均值(或最大值) | ||
- `agg_level=AggregateLevel.EACH_SEQUENCE`时: | ||
- 作用:一个双层序列经过运算变成一个单层序列 | ||
- 输入:必须是一个双层序列 | ||
- 输出:一个单层序列,序列的每个元素是原来双层序列每个subseq元素的平均值(或最大值) | ||
|
||
## last_seq 和 first_seq | ||
|
||
last_seq的使用示例如下(first_seq类似),详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#last-seq">配置API</a>。 | ||
```python | ||
last = last_seq(input=layer, | ||
agg_level=AggregateLevel.EACH_SEQUENCE) | ||
``` | ||
- `agg_level=AggregateLevel.TIMESTEP`时(默认值): | ||
- 作用:一个双层序列经过运算变成一个0层序列,或一个单层序列经过运算变成一个0层序列 | ||
- 输入:一个双层序列或一个单层序列 | ||
- 输出:一个0层序列,即整个输入序列(双层或者单层)最后一个,或第一个元素。 | ||
- `agg_level=AggregateLevel.EACH_SEQUENCE`时: | ||
- 作用:一个双层序列经过运算变成一个单层序列 | ||
- 输入:必须是一个双层序列 | ||
- 输出:一个单层序列,其中每个元素是双层序列中每个subseq最后一个(或第一个)元素。 | ||
|
||
## expand_layer | ||
|
||
expand_layer的使用示例如下,详细见<a href = "../../../doc/ui/api/trainer_config_helpers/layers.html#expand-layer">配置API</a>。 | ||
```python | ||
expand = expand_layer(input=layer1, | ||
expand_as=layer2, | ||
expand_level=ExpandLevel.FROM_TIMESTEP) | ||
``` | ||
- `expand_level=ExpandLevel.FROM_TIMESTEP`时(默认值): | ||
- 作用:一个0层序列经过运算扩展成一个单层序列,或者一个双层序列 | ||
- 输入:layer1必须是一个0层序列,是待扩展的数据;layer2可以是一个单层序列,或者是一个双层序列,提供扩展的长度信息 | ||
- 输出:一个单层序列,或一个双层序列,输出序列的类型(双层序列,或单层序列)和序列中含有元素的数目同 layer2一致。若输出是单层序列,单层序列的每个元素(0层序列),都是对layer1元素的拷贝;若输出是双层序列,双层序列每个subseq中每个元素(0层序列),都是对layer1元素的拷贝 | ||
- `expand_level=ExpandLevel.FROM_SEQUENCE`时: | ||
- 作用:一个单层序列经过运算扩展成一个双层序列 | ||
- 输入:layer1必须是一个单层序列,是待扩展的数据;layer2必须是一个双层序列,提供扩展的长度信息 | ||
- 输出:一个双层序列,序列中含有元素的数目同layer2一致。要求单层序列含有元素的数目(0层序列),和双层序列含有subseq 的数目一致。单层序列第i个元素(0层序列),被扩展为一个单层序列,构成了输出双层序列的第i个subseq。 |
Oops, something went wrong.