Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
a3ed9b00
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a3ed9b00
编写于
5月 11, 2018
作者:
G
guosheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refine docs of reader in Transformer by following comments
上级
f0fc20ee
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
45 addition
and
49 deletion
+45
-49
fluid/neural_machine_translation/transformer/reader.py
fluid/neural_machine_translation/transformer/reader.py
+45
-49
未找到文件。
fluid/neural_machine_translation/transformer/reader.py
浏览文件 @
a3ed9b00
...
@@ -64,8 +64,7 @@ class Pool(object):
...
@@ -64,8 +64,7 @@ class Pool(object):
class
DataReader
(
object
):
class
DataReader
(
object
):
"""
"""
The data reader loads all data from files and produces batches of data
The data reader loads all data from files and produces batches of data
in the way corresponding to settings. See the doc of __init__ function
in the way corresponding to settings.
for more setting details.
An example of returning a generator producing data batches whose data
An example of returning a generator producing data batches whose data
is shuffled in each pass and sorted in each pool:
is shuffled in each pass and sorted in each pool:
...
@@ -86,29 +85,6 @@ class DataReader(object):
...
@@ -86,29 +85,6 @@ class DataReader(object):
unk_mark='<unk>',
unk_mark='<unk>',
clip_last_batch=False).batch_generator
clip_last_batch=False).batch_generator
```
```
"""
def
__init__
(
self
,
src_vocab_fpath
,
trg_vocab_fpath
,
fpattern
,
batch_size
,
pool_size
,
sort_type
=
SortType
.
NONE
,
clip_last_batch
=
True
,
tar_fname
=
None
,
min_length
=
0
,
max_length
=
100
,
shuffle
=
True
,
shuffle_batch
=
False
,
use_token_batch
=
False
,
delimiter
=
"
\t
"
,
start_mark
=
"<s>"
,
end_mark
=
"<e>"
,
unk_mark
=
"<unk>"
,
seed
=
0
):
"""
Load all data from files and set the settings to make mini-batches.
:param src_vocab_fpath: The path of vocabulary file of source language.
:param src_vocab_fpath: The path of vocabulary file of source language.
:type src_vocab_fpath: basestring
:type src_vocab_fpath: basestring
...
@@ -154,6 +130,26 @@ class DataReader(object):
...
@@ -154,6 +130,26 @@ class DataReader(object):
:param seed: The seed for random.
:param seed: The seed for random.
:type seed: int
:type seed: int
"""
"""
def
__init__
(
self
,
src_vocab_fpath
,
trg_vocab_fpath
,
fpattern
,
batch_size
,
pool_size
,
sort_type
=
SortType
.
NONE
,
clip_last_batch
=
True
,
tar_fname
=
None
,
min_length
=
0
,
max_length
=
100
,
shuffle
=
True
,
shuffle_batch
=
False
,
use_token_batch
=
False
,
delimiter
=
"
\t
"
,
start_mark
=
"<s>"
,
end_mark
=
"<e>"
,
unk_mark
=
"<unk>"
,
seed
=
0
):
self
.
_src_vocab
=
self
.
load_dict
(
src_vocab_fpath
)
self
.
_src_vocab
=
self
.
load_dict
(
src_vocab_fpath
)
self
.
_only_src
=
True
self
.
_only_src
=
True
if
trg_vocab_fpath
is
not
None
:
if
trg_vocab_fpath
is
not
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录