Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
5a318e99
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看板
提交
5a318e99
编写于
9月 08, 2017
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adapt to the new folder structure of DS2
上级
efc5d9b1
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
25 addition
and
18 deletion
+25
-18
deep_speech_2/examples/librispeech/generate.sh
deep_speech_2/examples/librispeech/generate.sh
+3
-3
deep_speech_2/examples/librispeech/run_test.sh
deep_speech_2/examples/librispeech/run_test.sh
+4
-4
deep_speech_2/infer.py
deep_speech_2/infer.py
+3
-1
deep_speech_2/models/model.py
deep_speech_2/models/model.py
+8
-4
deep_speech_2/models/swig_decoders/README.md
deep_speech_2/models/swig_decoders/README.md
+0
-0
deep_speech_2/models/swig_decoders/__init__.py
deep_speech_2/models/swig_decoders/__init__.py
+0
-0
deep_speech_2/models/swig_decoders/_init_paths.py
deep_speech_2/models/swig_decoders/_init_paths.py
+0
-0
deep_speech_2/models/swig_decoders/ctc_decoders.cpp
deep_speech_2/models/swig_decoders/ctc_decoders.cpp
+2
-2
deep_speech_2/models/swig_decoders/ctc_decoders.h
deep_speech_2/models/swig_decoders/ctc_decoders.h
+1
-1
deep_speech_2/models/swig_decoders/decoder_utils.cpp
deep_speech_2/models/swig_decoders/decoder_utils.cpp
+0
-0
deep_speech_2/models/swig_decoders/decoder_utils.h
deep_speech_2/models/swig_decoders/decoder_utils.h
+0
-0
deep_speech_2/models/swig_decoders/decoders.i
deep_speech_2/models/swig_decoders/decoders.i
+0
-0
deep_speech_2/models/swig_decoders/path_trie.cpp
deep_speech_2/models/swig_decoders/path_trie.cpp
+0
-0
deep_speech_2/models/swig_decoders/path_trie.h
deep_speech_2/models/swig_decoders/path_trie.h
+0
-0
deep_speech_2/models/swig_decoders/scorer.cpp
deep_speech_2/models/swig_decoders/scorer.cpp
+0
-0
deep_speech_2/models/swig_decoders/scorer.h
deep_speech_2/models/swig_decoders/scorer.h
+0
-0
deep_speech_2/models/swig_decoders/setup.py
deep_speech_2/models/swig_decoders/setup.py
+0
-0
deep_speech_2/models/swig_decoders_wrapper.py
deep_speech_2/models/swig_decoders_wrapper.py
+2
-2
deep_speech_2/test.py
deep_speech_2/test.py
+2
-1
未找到文件。
deep_speech_2/examples/librispeech/generate.sh
浏览文件 @
5a318e99
...
...
@@ -12,9 +12,9 @@ python -u infer.py \
--num_conv_layers
=
2
\
--num_rnn_layers
=
3
\
--rnn_layer_size
=
2048
\
--alpha
=
0.36
\
--beta
=
0.
2
5
\
--cutoff_prob
=
0.99
\
--alpha
=
2.15
\
--beta
=
0.
3
5
\
--cutoff_prob
=
1.0
\
--use_gru
=
False
\
--use_gpu
=
True
\
--share_rnn_weights
=
True
\
...
...
deep_speech_2/examples/librispeech/run_test.sh
浏览文件 @
5a318e99
...
...
@@ -3,7 +3,7 @@
pushd
../..
CUDA_VISIBLE_DEVICES
=
0,1,2,3,4,5,6,7
\
python
-u
evaluate
.py
\
python
-u
test
.py
\
--batch_size
=
128
\
--trainer_count
=
8
\
--beam_size
=
500
\
...
...
@@ -12,9 +12,9 @@ python -u evaluate.py \
--num_conv_layers
=
2
\
--num_rnn_layers
=
3
\
--rnn_layer_size
=
2048
\
--alpha
=
0.36
\
--beta
=
0.
2
5
\
--cutoff_prob
=
0.99
\
--alpha
=
2.15
\
--beta
=
0.
3
5
\
--cutoff_prob
=
1.0
\
--use_gru
=
False
\
--use_gpu
=
True
\
--share_rnn_weights
=
True
\
...
...
deep_speech_2/infer.py
浏览文件 @
5a318e99
...
...
@@ -84,6 +84,8 @@ def infer():
use_gru
=
args
.
use_gru
,
pretrained_model_path
=
args
.
model_path
,
share_rnn_weights
=
args
.
share_rnn_weights
)
vocab_list
=
[
chars
.
encode
(
"utf-8"
)
for
chars
in
data_generator
.
vocab_list
]
result_transcripts
=
ds2_model
.
infer_batch
(
infer_data
=
infer_data
,
decoding_method
=
args
.
decoding_method
,
...
...
@@ -91,7 +93,7 @@ def infer():
beam_beta
=
args
.
beta
,
beam_size
=
args
.
beam_size
,
cutoff_prob
=
args
.
cutoff_prob
,
vocab_list
=
data_generator
.
vocab_list
,
vocab_list
=
vocab_list
,
language_model_path
=
args
.
lang_model_path
,
num_processes
=
args
.
num_proc_bsearch
)
...
...
deep_speech_2/models/model.py
浏览文件 @
5a318e99
...
...
@@ -8,8 +8,9 @@ import os
import
time
import
gzip
import
paddle.v2
as
paddle
from
lm.lm_scorer
import
LmScorer
from
models.decoder
import
ctc_greedy_decoder
,
ctc_beam_search_decoder
from
models.swig_decoders_wrapper
import
Scorer
from
models.swig_decoders_wrapper
import
ctc_greedy_decoder
from
models.swig_decoders_wrapper
import
ctc_beam_search_decoder_batch
from
models.network
import
deep_speech_v2_network
...
...
@@ -199,9 +200,12 @@ class DeepSpeech2Model(object):
elif
decoding_method
==
"ctc_beam_search"
:
# initialize external scorer
if
self
.
_ext_scorer
==
None
:
self
.
_ext_scorer
=
Lm
Scorer
(
beam_alpha
,
beam_beta
,
language_model_path
)
self
.
_ext_scorer
=
Scorer
(
beam_alpha
,
beam_beta
,
language_model_path
)
self
.
_loaded_lm_path
=
language_model_path
self
.
_ext_scorer
.
set_char_map
(
vocab_list
)
if
(
not
self
.
_ext_scorer
.
is_character_based
()):
self
.
_ext_scorer
.
fill_dictionary
(
True
)
else
:
self
.
_ext_scorer
.
reset_params
(
beam_alpha
,
beam_beta
)
assert
self
.
_loaded_lm_path
==
language_model_path
...
...
deep_speech_2/
deploy
/README.md
→
deep_speech_2/
models/swig_decoders
/README.md
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/__init__.py
→
deep_speech_2/
models/swig_decoders
/__init__.py
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/_init_paths.py
→
deep_speech_2/
models/swig_decoders
/_init_paths.py
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/ctc_decoders.cpp
→
deep_speech_2/
models/swig_decoders
/ctc_decoders.cpp
浏览文件 @
5a318e99
...
...
@@ -10,8 +10,8 @@
#include "fst/fstlib.h"
#include "path_trie.h"
std
::
string
ctc_
best_path
_decoder
(
std
::
vector
<
std
::
vector
<
double
>>
probs_seq
,
std
::
vector
<
std
::
string
>
vocabulary
)
{
std
::
string
ctc_
greedy
_decoder
(
std
::
vector
<
std
::
vector
<
double
>>
probs_seq
,
std
::
vector
<
std
::
string
>
vocabulary
)
{
// dimension check
int
num_time_steps
=
probs_seq
.
size
();
for
(
int
i
=
0
;
i
<
num_time_steps
;
i
++
)
{
...
...
deep_speech_2/
deploy
/ctc_decoders.h
→
deep_speech_2/
models/swig_decoders
/ctc_decoders.h
浏览文件 @
5a318e99
...
...
@@ -16,7 +16,7 @@
* A vector that each element is a pair of score and decoding result,
* in desending order.
*/
std
::
string
ctc_
best_path
_decoder
(
std
::
vector
<
std
::
vector
<
double
>>
probs_seq
,
std
::
string
ctc_
greedy
_decoder
(
std
::
vector
<
std
::
vector
<
double
>>
probs_seq
,
std
::
vector
<
std
::
string
>
vocabulary
);
/* CTC Beam Search Decoder
...
...
deep_speech_2/
deploy
/decoder_utils.cpp
→
deep_speech_2/
models/swig_decoders
/decoder_utils.cpp
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/decoder_utils.h
→
deep_speech_2/
models/swig_decoders
/decoder_utils.h
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/decoders.i
→
deep_speech_2/
models/swig_decoders
/decoders.i
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/path_trie.cpp
→
deep_speech_2/
models/swig_decoders
/path_trie.cpp
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/path_trie.h
→
deep_speech_2/
models/swig_decoders
/path_trie.h
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/scorer.cpp
→
deep_speech_2/
models/swig_decoders
/scorer.cpp
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/scorer.h
→
deep_speech_2/
models/swig_decoders
/scorer.h
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/setup.py
→
deep_speech_2/
models/swig_decoders
/setup.py
浏览文件 @
5a318e99
文件已移动
deep_speech_2/
deploy
/swig_decoders_wrapper.py
→
deep_speech_2/
models
/swig_decoders_wrapper.py
浏览文件 @
5a318e99
...
...
@@ -23,7 +23,7 @@ class Scorer(swig_decoders.Scorer):
swig_decoders
.
Scorer
.
__init__
(
self
,
alpha
,
beta
,
model_path
)
def
ctc_
best_path
_decoder
(
probs_seq
,
vocabulary
):
def
ctc_
greedy
_decoder
(
probs_seq
,
vocabulary
):
"""Wrapper for ctc best path decoder in swig.
:param probs_seq: 2-D list of probability distributions over each time
...
...
@@ -35,7 +35,7 @@ def ctc_best_path_decoder(probs_seq, vocabulary):
:return: Decoding result string.
:rtype: basestring
"""
return
swig_decoders
.
ctc_
best_path
_decoder
(
probs_seq
.
tolist
(),
vocabulary
)
return
swig_decoders
.
ctc_
greedy
_decoder
(
probs_seq
.
tolist
(),
vocabulary
)
def
ctc_beam_search_decoder
(
probs_seq
,
...
...
deep_speech_2/test.py
浏览文件 @
5a318e99
...
...
@@ -85,6 +85,7 @@ def evaluate():
pretrained_model_path
=
args
.
model_path
,
share_rnn_weights
=
args
.
share_rnn_weights
)
vocab_list
=
[
chars
.
encode
(
"utf-8"
)
for
chars
in
data_generator
.
vocab_list
]
error_rate_func
=
cer
if
args
.
error_rate_type
==
'cer'
else
wer
error_sum
,
num_ins
=
0.0
,
0
for
infer_data
in
batch_reader
():
...
...
@@ -95,7 +96,7 @@ def evaluate():
beam_beta
=
args
.
beta
,
beam_size
=
args
.
beam_size
,
cutoff_prob
=
args
.
cutoff_prob
,
vocab_list
=
data_generator
.
vocab_list
,
vocab_list
=
vocab_list
,
language_model_path
=
args
.
lang_model_path
,
num_processes
=
args
.
num_proc_bsearch
)
target_transcripts
=
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录