Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
4d87afd6
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看板
未验证
提交
4d87afd6
编写于
12月 19, 2020
作者:
L
liu zhengxi
提交者:
GitHub
12月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix hung (#5121)
* fix hung * add shuffle batch * update * reader_seed to shuffle_seed * seed for shuffle batch
上级
047b8b69
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
2 deletion
+40
-2
PaddleNLP/benchmark/transformer/configs/transformer.big.yaml
PaddleNLP/benchmark/transformer/configs/transformer.big.yaml
+6
-0
PaddleNLP/benchmark/transformer/reader.py
PaddleNLP/benchmark/transformer/reader.py
+11
-1
PaddleNLP/examples/machine_translation/transformer/configs/transformer.base.yaml
...ine_translation/transformer/configs/transformer.base.yaml
+6
-0
PaddleNLP/examples/machine_translation/transformer/configs/transformer.big.yaml
...hine_translation/transformer/configs/transformer.big.yaml
+6
-0
PaddleNLP/examples/machine_translation/transformer/reader.py
PaddleNLP/examples/machine_translation/transformer/reader.py
+11
-1
未找到文件。
PaddleNLP/benchmark/transformer/configs/transformer.big.yaml
浏览文件 @
4d87afd6
...
...
@@ -27,6 +27,12 @@ pool_size: 200000
sort_type
:
"
global"
batch_size
:
4096
infer_batch_size
:
16
shuffle_batch
:
True
# Data shuffle only works when sort_type is pool or none
shuffle
:
True
# shuffle_seed must be set when shuffle is True and using multi-cards to train.
# Otherwise, the number of batches cannot be guaranteed.
shuffle_seed
:
128
# Hyparams for training:
# The number of epoches for training
...
...
PaddleNLP/benchmark/transformer/reader.py
浏览文件 @
4d87afd6
...
...
@@ -43,6 +43,12 @@ def create_data_loader(args):
mode
=
m
,
transform_func
=
transform_func
)
for
m
in
[
"train"
,
"dev"
]
]
if
args
.
shuffle
or
args
.
shuffle_batch
:
if
args
.
shuffle_seed
==
"None"
or
args
.
shuffle_seed
is
None
:
shuffle_seed
=
0
else
:
shuffle_seed
=
args
.
shuffle_seed
def
_max_token_fn
(
current_idx
,
current_batch_size
,
tokens_sofar
,
data_source
):
return
max
(
tokens_sofar
,
...
...
@@ -69,7 +75,8 @@ def create_data_loader(args):
key
=
trg_key
,
buffer_size
=
buffer_size
).
sort
(
key
=
src_key
,
buffer_size
=
buffer_size
)
else
:
sampler
=
sampler
.
shuffle
()
if
args
.
shuffle
:
sampler
=
sampler
.
shuffle
(
seed
=
shuffle_seed
)
if
args
.
sort_type
==
SortType
.
POOL
:
buffer_size
=
args
.
pool_size
sampler
=
sampler
.
sort
(
key
=
src_key
,
buffer_size
=
buffer_size
)
...
...
@@ -83,6 +90,9 @@ def create_data_loader(args):
if
m
==
"train"
:
batch_sampler
=
batch_sampler
.
shard
()
if
args
.
shuffle_batch
:
batch_sampler
.
shuffle
(
seed
=
shuffle_seed
)
data_loader
=
DataLoader
(
dataset
=
dataset
,
batch_sampler
=
batch_sampler
,
...
...
PaddleNLP/examples/machine_translation/transformer/configs/transformer.base.yaml
浏览文件 @
4d87afd6
...
...
@@ -27,6 +27,12 @@ pool_size: 200000
sort_type
:
"
global"
batch_size
:
4096
infer_batch_size
:
8
shuffle_batch
:
True
# Data shuffle only works when sort_type is pool or none
shuffle
:
True
# shuffle_seed must be set when shuffle is True and using multi-cards to train.
# Otherwise, the number of batches cannot be guaranteed.
shuffle_seed
:
128
# Hyparams for training:
# The number of epoches for training
...
...
PaddleNLP/examples/machine_translation/transformer/configs/transformer.big.yaml
浏览文件 @
4d87afd6
...
...
@@ -27,6 +27,12 @@ pool_size: 200000
sort_type
:
"
global"
batch_size
:
4096
infer_batch_size
:
8
shuffle_batch
:
True
# Data shuffle only works when sort_type is pool or none
shuffle
:
True
# shuffle_seed must be set when shuffle is True and using multi-cards to train.
# Otherwise, the number of batches cannot be guaranteed.
shuffle_seed
:
128
# Hyparams for training:
# The number of epoches for training
...
...
PaddleNLP/examples/machine_translation/transformer/reader.py
浏览文件 @
4d87afd6
...
...
@@ -43,6 +43,12 @@ def create_data_loader(args):
mode
=
m
,
transform_func
=
transform_func
)
for
m
in
[
"train"
,
"dev"
]
]
if
args
.
shuffle
or
args
.
shuffle_batch
:
if
args
.
shuffle_seed
==
"None"
or
args
.
shuffle_seed
is
None
:
shuffle_seed
=
0
else
:
shuffle_seed
=
args
.
shuffle_seed
def
_max_token_fn
(
current_idx
,
current_batch_size
,
tokens_sofar
,
data_source
):
return
max
(
tokens_sofar
,
...
...
@@ -69,7 +75,8 @@ def create_data_loader(args):
key
=
trg_key
,
buffer_size
=
buffer_size
).
sort
(
key
=
src_key
,
buffer_size
=
buffer_size
)
else
:
sampler
=
sampler
.
shuffle
()
if
args
.
shuffle
:
sampler
=
sampler
.
shuffle
(
seed
=
shuffle_seed
)
if
args
.
sort_type
==
SortType
.
POOL
:
buffer_size
=
args
.
pool_size
sampler
=
sampler
.
sort
(
key
=
src_key
,
buffer_size
=
buffer_size
)
...
...
@@ -83,6 +90,9 @@ def create_data_loader(args):
if
m
==
"train"
:
batch_sampler
=
batch_sampler
.
shard
()
if
args
.
shuffle_batch
:
batch_sampler
.
shuffle
(
seed
=
shuffle_seed
)
data_loader
=
DataLoader
(
dataset
=
dataset
,
batch_sampler
=
batch_sampler
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录