Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
d6d819c2
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看板
提交
d6d819c2
编写于
2月 07, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adjust dir struct and fix bug in data_reader
上级
b92c05ae
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
43 addition
and
13 deletion
+43
-13
fluid/DeepASR/data_utils/data_reader.py
fluid/DeepASR/data_utils/data_reader.py
+2
-2
fluid/DeepASR/model_utils/model.py
fluid/DeepASR/model_utils/model.py
+6
-2
fluid/DeepASR/tools/_init_paths.py
fluid/DeepASR/tools/_init_paths.py
+19
-0
fluid/DeepASR/tools/profile.py
fluid/DeepASR/tools/profile.py
+8
-5
fluid/DeepASR/train.py
fluid/DeepASR/train.py
+8
-4
未找到文件。
fluid/DeepASR/data_utils/data_reader.py
浏览文件 @
d6d819c2
...
@@ -225,8 +225,8 @@ class DataReader(object):
...
@@ -225,8 +225,8 @@ class DataReader(object):
@
suppress_complaints
(
verbose
=
self
.
_verbose
)
@
suppress_complaints
(
verbose
=
self
.
_verbose
)
def
ordered_processing_task
(
sample_info_queue
,
sample_queue
,
out_order
):
def
ordered_processing_task
(
sample_info_queue
,
sample_queue
,
out_order
):
if
self
.
_verbose
==
0
:
if
self
.
_verbose
==
0
:
signal
.
signal
(
signal
.
SIGTERM
,
suppress_signal
()
)
signal
.
signal
(
signal
.
SIGTERM
,
suppress_signal
)
signal
.
signal
(
signal
.
SIGINT
,
suppress_signal
()
)
signal
.
signal
(
signal
.
SIGINT
,
suppress_signal
)
def
read_bytes
(
fpath
,
start
,
size
):
def
read_bytes
(
fpath
,
start
,
size
):
f
=
open
(
fpath
,
'r'
)
f
=
open
(
fpath
,
'r'
)
...
...
fluid/DeepASR/model.py
→
fluid/DeepASR/model
_utils/model
.py
浏览文件 @
d6d819c2
...
@@ -9,12 +9,16 @@ import paddle.v2.fluid as fluid
...
@@ -9,12 +9,16 @@ import paddle.v2.fluid as fluid
def
stacked_lstmp_model
(
hidden_dim
,
def
stacked_lstmp_model
(
hidden_dim
,
proj_dim
,
proj_dim
,
stacked_num
,
stacked_num
,
class_num
,
parallel
=
False
,
parallel
=
False
,
is_train
=
True
,
is_train
=
True
):
class_num
=
1749
):
""" The model for DeepASR. The main structure is composed of stacked
""" The model for DeepASR. The main structure is composed of stacked
identical LSTMP (LSTM with recurrent projection) layers.
identical LSTMP (LSTM with recurrent projection) layers.
When running in training and validation phase, the feeding dictionary
is {'feature', 'label'}, fed by the LodTensor for feature data and
label data respectively. And in inference, only `feature` is needed.
Args:
Args:
hidden_dim(int): The hidden state's dimension of the LSTMP layer.
hidden_dim(int): The hidden state's dimension of the LSTMP layer.
proj_dim(int): The projection size of the LSTMP layer.
proj_dim(int): The projection size of the LSTMP layer.
...
...
fluid/DeepASR/tools/_init_paths.py
0 → 100644
浏览文件 @
d6d819c2
"""Add the parent directory to $PYTHONPATH"""
from
__future__
import
absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os.path
import
sys
def
add_path
(
path
):
if
path
not
in
sys
.
path
:
sys
.
path
.
insert
(
0
,
path
)
this_dir
=
os
.
path
.
dirname
(
__file__
)
# Add project path to PYTHONPATH
proj_path
=
os
.
path
.
join
(
this_dir
,
'..'
)
add_path
(
proj_path
)
fluid/DeepASR/profile.py
→
fluid/DeepASR/
tools/
profile.py
浏览文件 @
d6d819c2
...
@@ -7,14 +7,14 @@ import numpy as np
...
@@ -7,14 +7,14 @@ import numpy as np
import
argparse
import
argparse
import
time
import
time
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid.profiler
as
profiler
import
paddle.v2.fluid.profiler
as
profiler
import
_init_paths
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.data_reader
as
reader
import
data_utils.data_reader
as
reader
from
model
import
stacked_lstmp_model
from
model
_utils.model
import
stacked_lstmp_model
from
data_utils.util
import
lodtensor_to_ndarray
from
data_utils.util
import
lodtensor_to_ndarray
...
@@ -118,8 +118,12 @@ def profile(args):
...
@@ -118,8 +118,12 @@ def profile(args):
raise
ValueError
(
raise
ValueError
(
"arg 'first_batches_to_skip' must not be smaller than 0."
)
"arg 'first_batches_to_skip' must not be smaller than 0."
)
_
,
avg_cost
,
accuracy
=
stacked_lstmp_model
(
args
.
hidden_dim
,
args
.
proj_dim
,
_
,
avg_cost
,
accuracy
=
stacked_lstmp_model
(
args
.
stacked_num
,
args
.
parallel
)
hidden_dim
=
args
.
hidden_dim
,
proj_dim
=
args
.
proj_dim
,
stacked_num
=
args
.
stacked_num
,
class_num
=
1749
,
parallel
=
args
.
parallel
)
adam_optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
=
args
.
learning_rate
)
adam_optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
=
args
.
learning_rate
)
adam_optimizer
.
minimize
(
avg_cost
)
adam_optimizer
.
minimize
(
avg_cost
)
...
@@ -173,7 +177,6 @@ def profile(args):
...
@@ -173,7 +177,6 @@ def profile(args):
else
:
else
:
sys
.
stdout
.
write
(
'.'
)
sys
.
stdout
.
write
(
'.'
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
time_consumed
=
time
.
time
()
-
start_time
time_consumed
=
time
.
time
()
-
start_time
frames_per_sec
=
frames_seen
/
time_consumed
frames_per_sec
=
frames_seen
/
time_consumed
print
(
"
\n
Time consumed: %f s, performance: %f frames/s."
%
print
(
"
\n
Time consumed: %f s, performance: %f frames/s."
%
...
...
fluid/DeepASR/train.py
浏览文件 @
d6d819c2
...
@@ -8,15 +8,13 @@ import numpy as np
...
@@ -8,15 +8,13 @@ import numpy as np
import
argparse
import
argparse
import
time
import
time
import
paddle.v2
as
paddle
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid
as
fluid
import
paddle.v2.fluid.profiler
as
profiler
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_mean_variance_norm
as
trans_mean_variance_norm
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.data_reader
as
reader
import
data_utils.data_reader
as
reader
from
data_utils.util
import
lodtensor_to_ndarray
from
data_utils.util
import
lodtensor_to_ndarray
from
model
import
stacked_lstmp_model
from
model
_utils.model
import
stacked_lstmp_model
def
parse_args
():
def
parse_args
():
...
@@ -116,8 +114,14 @@ def train(args):
...
@@ -116,8 +114,14 @@ def train(args):
"""train in loop.
"""train in loop.
"""
"""
# prediction, avg_cost, accuracy = stacked_lstmp_model(args.hidden_dim,
# args.proj_dim, args.stacked_num, class_num=1749, args.parallel)
prediction
,
avg_cost
,
accuracy
=
stacked_lstmp_model
(
prediction
,
avg_cost
,
accuracy
=
stacked_lstmp_model
(
args
.
hidden_dim
,
args
.
proj_dim
,
args
.
stacked_num
,
args
.
parallel
)
hidden_dim
=
args
.
hidden_dim
,
proj_dim
=
args
.
proj_dim
,
stacked_num
=
args
.
stacked_num
,
class_num
=
1749
,
parallel
=
args
.
parallel
)
adam_optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
=
args
.
learning_rate
)
adam_optimizer
=
fluid
.
optimizer
.
Adam
(
learning_rate
=
args
.
learning_rate
)
adam_optimizer
.
minimize
(
avg_cost
)
adam_optimizer
.
minimize
(
avg_cost
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录