Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
fe241986
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看板
提交
fe241986
编写于
9月 03, 2017
作者:
X
Xinghai Sun
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into network_structure
上级
35bc7170
50643462
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
27 deletion
+28
-27
deep_speech_2/cloud/pcloud_submit.sh
deep_speech_2/cloud/pcloud_submit.sh
+2
-2
deep_speech_2/data_utils/data.py
deep_speech_2/data_utils/data.py
+12
-12
deep_speech_2/data_utils/featurizer/audio_featurizer.py
deep_speech_2/data_utils/featurizer/audio_featurizer.py
+1
-1
deep_speech_2/layer.py
deep_speech_2/layer.py
+9
-5
ltr/metrics.py
ltr/metrics.py
+4
-7
未找到文件。
deep_speech_2/cloud/pcloud_submit.sh
浏览文件 @
fe241986
TRAIN_MANIFEST
=
"cloud/cloud.manifest.train"
TRAIN_MANIFEST
=
"cloud/cloud.manifest.train"
DEV_MANIFEST
=
"cloud/cloud.manifest.dev"
DEV_MANIFEST
=
"cloud/cloud.manifest.dev"
CLOUD_MODEL_DIR
=
"
/pfs/dlnel/home/USERNAME/deepspeech2/model
"
CLOUD_MODEL_DIR
=
"
./checkpoints
"
BATCH_SIZE
=
256
BATCH_SIZE
=
256
NUM_GPU
=
8
NUM_GPU
=
8
NUM_NODE
=
1
NUM_NODE
=
1
...
@@ -11,7 +11,7 @@ DS2_PATH=${PWD%/*}
...
@@ -11,7 +11,7 @@ DS2_PATH=${PWD%/*}
cp
-f
pcloud_train.sh
${
DS2_PATH
}
cp
-f
pcloud_train.sh
${
DS2_PATH
}
paddlecloud submit
\
paddlecloud submit
\
-image
bootstrapper:5000/
wanghaoshuang
/pcloud_ds2:latest
\
-image
bootstrapper:5000/
paddlepaddle
/pcloud_ds2:latest
\
-jobname
${
JOB_NAME
}
\
-jobname
${
JOB_NAME
}
\
-cpu
${
NUM_GPU
}
\
-cpu
${
NUM_GPU
}
\
-gpu
${
NUM_GPU
}
\
-gpu
${
NUM_GPU
}
\
...
...
deep_speech_2/data_utils/data.py
浏览文件 @
fe241986
...
@@ -85,9 +85,9 @@ class DataGenerator(object):
...
@@ -85,9 +85,9 @@ class DataGenerator(object):
self
.
_rng
=
random
.
Random
(
random_seed
)
self
.
_rng
=
random
.
Random
(
random_seed
)
self
.
_epoch
=
0
self
.
_epoch
=
0
# for caching tar files info
# for caching tar files info
self
.
local_data
=
local
()
self
.
_
local_data
=
local
()
self
.
local_data
.
tar2info
=
{}
self
.
_
local_data
.
tar2info
=
{}
self
.
local_data
.
tar2object
=
{}
self
.
_
local_data
.
tar2object
=
{}
def
process_utterance
(
self
,
filename
,
transcript
):
def
process_utterance
(
self
,
filename
,
transcript
):
"""Load, augment, featurize and normalize for speech data.
"""Load, augment, featurize and normalize for speech data.
...
@@ -240,16 +240,16 @@ class DataGenerator(object):
...
@@ -240,16 +240,16 @@ class DataGenerator(object):
"""
"""
if
file
.
startswith
(
'tar:'
):
if
file
.
startswith
(
'tar:'
):
tarpath
,
filename
=
file
.
split
(
':'
,
1
)[
1
].
split
(
'#'
,
1
)
tarpath
,
filename
=
file
.
split
(
':'
,
1
)[
1
].
split
(
'#'
,
1
)
if
'tar2info'
not
in
self
.
local_data
.
__dict__
:
if
'tar2info'
not
in
self
.
_
local_data
.
__dict__
:
self
.
local_data
.
tar2info
=
{}
self
.
_
local_data
.
tar2info
=
{}
if
'tar2object'
not
in
self
.
local_data
.
__dict__
:
if
'tar2object'
not
in
self
.
_
local_data
.
__dict__
:
self
.
local_data
.
tar2object
=
{}
self
.
_
local_data
.
tar2object
=
{}
if
tarpath
not
in
self
.
local_data
.
tar2info
:
if
tarpath
not
in
self
.
_
local_data
.
tar2info
:
object
,
infoes
=
self
.
_parse_tar
(
tarpath
)
object
,
infoes
=
self
.
_parse_tar
(
tarpath
)
self
.
local_data
.
tar2info
[
tarpath
]
=
infoes
self
.
_
local_data
.
tar2info
[
tarpath
]
=
infoes
self
.
local_data
.
tar2object
[
tarpath
]
=
object
self
.
_
local_data
.
tar2object
[
tarpath
]
=
object
return
self
.
local_data
.
tar2object
[
tarpath
].
extractfile
(
return
self
.
_
local_data
.
tar2object
[
tarpath
].
extractfile
(
self
.
local_data
.
tar2info
[
tarpath
][
filename
])
self
.
_
local_data
.
tar2info
[
tarpath
][
filename
])
else
:
else
:
return
open
(
file
,
'r'
)
return
open
(
file
,
'r'
)
...
...
deep_speech_2/data_utils/featurizer/audio_featurizer.py
浏览文件 @
fe241986
...
@@ -57,7 +57,7 @@ class AudioFeaturizer(object):
...
@@ -57,7 +57,7 @@ class AudioFeaturizer(object):
def
featurize
(
self
,
def
featurize
(
self
,
audio_segment
,
audio_segment
,
allow_downsampling
=
True
,
allow_downsampling
=
True
,
allow_upsampl
l
ing
=
True
):
allow_upsampling
=
True
):
"""Extract audio features from AudioSegment or SpeechSegment.
"""Extract audio features from AudioSegment or SpeechSegment.
:param audio_segment: Audio/speech segment to extract features from.
:param audio_segment: Audio/speech segment to extract features from.
...
...
deep_speech_2/layer.py
浏览文件 @
fe241986
...
@@ -55,16 +55,20 @@ def bidirectional_simple_rnn_bn_layer(name, input, size, act):
...
@@ -55,16 +55,20 @@ def bidirectional_simple_rnn_bn_layer(name, input, size, act):
:rtype: LayerOutput
:rtype: LayerOutput
"""
"""
# input-hidden weights shared across bi-direcitonal rnn.
# input-hidden weights shared across bi-direcitonal rnn.
input_proj
=
paddle
.
layer
.
fc
(
input_proj_forward
=
paddle
.
layer
.
fc
(
input
=
input
,
size
=
size
,
act
=
paddle
.
activation
.
Linear
(),
bias_attr
=
False
)
input_proj_backward
=
paddle
.
layer
.
fc
(
input
=
input
,
size
=
size
,
act
=
paddle
.
activation
.
Linear
(),
bias_attr
=
False
)
input
=
input
,
size
=
size
,
act
=
paddle
.
activation
.
Linear
(),
bias_attr
=
False
)
# batch norm is only performed on input-state projection
# batch norm is only performed on input-state projection
input_proj_bn
=
paddle
.
layer
.
batch_norm
(
input_proj_bn_forward
=
paddle
.
layer
.
batch_norm
(
input
=
input_proj
,
act
=
paddle
.
activation
.
Linear
())
input
=
input_proj_forward
,
act
=
paddle
.
activation
.
Linear
())
input_proj_bn_backward
=
paddle
.
layer
.
batch_norm
(
input
=
input_proj_backward
,
act
=
paddle
.
activation
.
Linear
())
# forward and backward in time
# forward and backward in time
forward_simple_rnn
=
paddle
.
layer
.
recurrent
(
forward_simple_rnn
=
paddle
.
layer
.
recurrent
(
input
=
input_proj_bn
,
act
=
act
,
reverse
=
False
)
input
=
input_proj_bn
_forward
,
act
=
act
,
reverse
=
False
)
backward_simple_rnn
=
paddle
.
layer
.
recurrent
(
backward_simple_rnn
=
paddle
.
layer
.
recurrent
(
input
=
input_proj_bn
,
act
=
act
,
reverse
=
True
)
input
=
input_proj_bn
_backward
,
act
=
act
,
reverse
=
True
)
return
paddle
.
layer
.
concat
(
input
=
[
forward_simple_rnn
,
backward_simple_rnn
])
return
paddle
.
layer
.
concat
(
input
=
[
forward_simple_rnn
,
backward_simple_rnn
])
...
...
ltr/metrics.py
浏览文件 @
fe241986
...
@@ -19,7 +19,7 @@ def ndcg(score_list):
...
@@ -19,7 +19,7 @@ def ndcg(score_list):
n
=
len
(
score_list
)
n
=
len
(
score_list
)
cost
=
.
0
cost
=
.
0
for
i
in
range
(
n
):
for
i
in
range
(
n
):
cost
+=
float
(
score_list
[
i
]
)
/
np
.
log
((
i
+
1
)
+
1
)
cost
+=
float
(
np
.
power
(
2
,
score_list
[
i
])
)
/
np
.
log
((
i
+
1
)
+
1
)
return
cost
return
cost
dcg_cost
=
dcg
(
score_list
)
dcg_cost
=
dcg
(
score_list
)
...
@@ -28,14 +28,11 @@ def ndcg(score_list):
...
@@ -28,14 +28,11 @@ def ndcg(score_list):
return
dcg_cost
/
ideal_cost
return
dcg_cost
/
ideal_cost
class
NdcgTest
(
unittest
.
TestCase
):
class
TestNDCG
(
unittest
.
TestCase
):
def
__init__
(
self
):
def
test_array
(
self
):
pass
def
runcase
(
self
):
a
=
[
3
,
2
,
3
,
0
,
1
,
2
]
a
=
[
3
,
2
,
3
,
0
,
1
,
2
]
value
=
ndcg
(
a
)
value
=
ndcg
(
a
)
self
.
assertAlmostEqual
(
0.9
61
,
value
,
places
=
3
)
self
.
assertAlmostEqual
(
0.9
583
,
value
,
places
=
3
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录