Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
79cb57cc
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
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看板
提交
79cb57cc
编写于
2月 03, 2018
作者:
Y
yangyaming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the exiting logic for sample generator.
上级
49fb3e6b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
12 deletion
+10
-12
fluid/DeepASR/data_utils/parallel_reader.py
fluid/DeepASR/data_utils/parallel_reader.py
+10
-12
未找到文件。
fluid/DeepASR/data_utils/parallel_reader.py
浏览文件 @
79cb57cc
...
@@ -98,8 +98,8 @@ class DataReader(object):
...
@@ -98,8 +98,8 @@ class DataReader(object):
self
.
_label_file_list
=
label_file_list
self
.
_label_file_list
=
label_file_list
self
.
_block_info_list
=
None
self
.
_block_info_list
=
None
self
.
_bucket_list
=
None
self
.
_bucket_list
=
None
self
.
_order_id
=
0
self
.
generate_bucket_list
(
True
)
self
.
generate_bucket_list
(
True
)
self
.
_order_id
=
0
def
generate_bucket_list
(
self
,
is_shuffle
):
def
generate_bucket_list
(
self
,
is_shuffle
):
if
self
.
_block_info_list
is
None
:
if
self
.
_block_info_list
is
None
:
...
@@ -136,7 +136,7 @@ class DataReader(object):
...
@@ -136,7 +136,7 @@ class DataReader(object):
manager
=
Manager
()
manager
=
Manager
()
sample_info_queue
=
manager
.
Queue
(
1024
)
sample_info_queue
=
manager
.
Queue
(
1024
)
sample_queue
=
manager
.
Queue
(
1024
)
sample_queue
=
manager
.
Queue
(
1024
)
process_num
=
1
process_num
=
2
self
.
_order_id
=
0
self
.
_order_id
=
0
def
ordered_feeding_worker
(
sample_info_queue
):
def
ordered_feeding_worker
(
sample_info_queue
):
...
@@ -161,6 +161,7 @@ class DataReader(object):
...
@@ -161,6 +161,7 @@ class DataReader(object):
ins
=
sample_info_queue
.
get
()
ins
=
sample_info_queue
.
get
()
while
not
isinstance
(
ins
,
EpochEndSignal
):
while
not
isinstance
(
ins
,
EpochEndSignal
):
# @TODO(pkuyym) add block cache to cache several block (LRU) into memory
sample_info
,
order_id
=
ins
sample_info
,
order_id
=
ins
f_feature
=
open
(
sample_info
.
feature_bin_path
,
'r'
)
f_feature
=
open
(
sample_info
.
feature_bin_path
,
'r'
)
f_label
=
open
(
sample_info
.
label_bin_path
,
'r'
)
f_label
=
open
(
sample_info
.
label_bin_path
,
'r'
)
...
@@ -200,17 +201,11 @@ class DataReader(object):
...
@@ -200,17 +201,11 @@ class DataReader(object):
if
self
.
_drop_sentence_len
>=
sample_data
[
0
].
shape
[
0
]:
if
self
.
_drop_sentence_len
>=
sample_data
[
0
].
shape
[
0
]:
sample_queue
.
put
(
sample_data
)
sample_queue
.
put
(
sample_data
)
print
(
'sub process: %d'
%
sample_queue
.
qsize
())
out_order
[
0
]
+=
1
out_order
[
0
]
+=
1
time
.
sleep
(
0.1
)
if
order_id
==
self
.
_order_id
:
sample_queue
.
put
(
EpochEndSignal
())
ins
=
sample_info_queue
.
get
()
ins
=
sample_info_queue
.
get
()
sample_queue
.
put
(
EpochEndSignal
())
out_order
=
manager
.
list
([
0
])
out_order
=
manager
.
list
([
0
])
args
=
(
sample_info_queue
,
sample_queue
,
out_order
)
args
=
(
sample_info_queue
,
sample_queue
,
out_order
)
workers
=
[
workers
=
[
...
@@ -223,10 +218,13 @@ class DataReader(object):
...
@@ -223,10 +218,13 @@ class DataReader(object):
w
.
daemon
=
True
w
.
daemon
=
True
w
.
start
()
w
.
start
()
finished_process_num
=
0
while
True
:
while
True
:
print
(
'main thread: %d'
%
sample_queue
.
qsize
())
sample
=
sample_queue
.
get
()
sample
=
sample_queue
.
get
()
if
isinstance
(
sample
,
EpochEndSignal
):
break
if
isinstance
(
sample
,
EpochEndSignal
):
finished_process_num
+=
1
continue
yield
sample
yield
sample
feeding_thread
.
join
()
feeding_thread
.
join
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录