Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
06b3d482
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06b3d482
编写于
6月 15, 2020
作者:
J
jonyguo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. add set_dataset_size for MindDataset 2. modify parameter dupe_factor from 5 to 10
上级
5845c4ad
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
15 deletion
+25
-15
example/nlp_to_mindrecord/zhwiki/run.sh
example/nlp_to_mindrecord/zhwiki/run.sh
+1
-1
example/nlp_to_mindrecord/zhwiki/run_simple.sh
example/nlp_to_mindrecord/zhwiki/run_simple.sh
+1
-1
mindspore/dataset/engine/datasets.py
mindspore/dataset/engine/datasets.py
+23
-13
未找到文件。
example/nlp_to_mindrecord/zhwiki/run.sh
浏览文件 @
06b3d482
...
...
@@ -83,7 +83,7 @@ for index in $(seq 0 $file_list_len); do
--max_predictions_per_seq
=
20
\
--masked_lm_prob
=
0.15
\
--random_seed
=
12345
\
--dupe_factor
=
5
>
/tmp/
${
output_filename
[
$index
]
}
.log 2>&1 &
--dupe_factor
=
10
>
/tmp/
${
output_filename
[
$index
]
}
.log 2>&1 &
# user defined
process_count
=
`
ps
-ef
|
grep
create_pretraining_data_patched |
grep
-v
grep
|
wc
-l
`
echo
"Total task:
${#
file_list
[*]
}
, processing:
${
process_count
}
"
if
[
$process_count
-ge
$avaiable_core_size
]
;
then
...
...
example/nlp_to_mindrecord/zhwiki/run_simple.sh
浏览文件 @
06b3d482
...
...
@@ -44,4 +44,4 @@ python ../../../third_party/to_mindrecord/zhwiki/create_pretraining_data_patched
--max_predictions_per_seq
=
20
\
--masked_lm_prob
=
0.15
\
--random_seed
=
12345
\
--dupe_factor
=
5
--dupe_factor
=
10
# user defined
mindspore/dataset/engine/datasets.py
浏览文件 @
06b3d482
...
...
@@ -2671,20 +2671,30 @@ class MindDataset(SourceDataset):
Return:
Number, number of batches.
"""
if
self
.
load_dataset
:
dataset_file
=
[
self
.
dataset_file
]
else
:
dataset_file
=
self
.
dataset_file
num_rows
=
MindRecordOp
.
get_num_rows
(
dataset_file
,
self
.
load_dataset
,
self
.
sampler
,
self
.
num_padded
)
if
self
.
partitions
is
not
None
and
self
.
partitions
[
0
]
>
0
:
if
num_rows
%
self
.
partitions
[
0
]
==
0
:
num_rows
=
num_rows
//
self
.
partitions
[
0
]
if
self
.
_dataset_size
is
None
:
if
self
.
load_dataset
:
dataset_file
=
[
self
.
dataset_file
]
else
:
if
self
.
num_padded
>
0
:
raise
RuntimeError
(
"Dataset size plus number of padded samples is not divisible by number of shards."
)
num_rows
=
num_rows
//
self
.
partitions
[
0
]
+
1
return
num_rows
dataset_file
=
self
.
dataset_file
num_rows
=
MindRecordOp
.
get_num_rows
(
dataset_file
,
self
.
load_dataset
,
self
.
sampler
,
self
.
num_padded
)
if
self
.
partitions
is
not
None
and
self
.
partitions
[
0
]
>
0
:
if
num_rows
%
self
.
partitions
[
0
]
==
0
:
num_rows
=
num_rows
//
self
.
partitions
[
0
]
else
:
if
self
.
num_padded
>
0
:
raise
RuntimeError
(
"Dataset size plus number of padded samples is not divisible by number of shards."
)
num_rows
=
num_rows
//
self
.
partitions
[
0
]
+
1
return
num_rows
return
self
.
_dataset_size
# manually set dataset_size as a tempoary solution.
def
set_dataset_size
(
self
,
value
):
logger
.
warning
(
"WARN_DEPRECATED: This method is deprecated. Please use get_dataset_size directly."
)
if
value
>=
0
:
self
.
_dataset_size
=
value
else
:
raise
ValueError
(
'set dataset_size with negative value {}'
.
format
(
value
))
def
is_shuffled
(
self
):
if
self
.
shuffle_option
is
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录