Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
7d0458c7
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
12 个月 前同步成功
通知
205
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d0458c7
编写于
9月 08, 2017
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adapt to the new folder structure of DS2
上级
11ede80a
变更
19
显示空白变更内容
内联
并排
Showing
19 changed file
with
25 addition
and
18 deletion
+25
-18
examples/librispeech/generate.sh
examples/librispeech/generate.sh
+3
-3
examples/librispeech/run_test.sh
examples/librispeech/run_test.sh
+4
-4
infer.py
infer.py
+3
-1
models/model.py
models/model.py
+8
-4
models/swig_decoders/README.md
models/swig_decoders/README.md
+0
-0
models/swig_decoders/__init__.py
models/swig_decoders/__init__.py
+0
-0
models/swig_decoders/_init_paths.py
models/swig_decoders/_init_paths.py
+0
-0
models/swig_decoders/ctc_decoders.cpp
models/swig_decoders/ctc_decoders.cpp
+2
-2
models/swig_decoders/ctc_decoders.h
models/swig_decoders/ctc_decoders.h
+1
-1
models/swig_decoders/decoder_utils.cpp
models/swig_decoders/decoder_utils.cpp
+0
-0
models/swig_decoders/decoder_utils.h
models/swig_decoders/decoder_utils.h
+0
-0
models/swig_decoders/decoders.i
models/swig_decoders/decoders.i
+0
-0
models/swig_decoders/path_trie.cpp
models/swig_decoders/path_trie.cpp
+0
-0
models/swig_decoders/path_trie.h
models/swig_decoders/path_trie.h
+0
-0
models/swig_decoders/scorer.cpp
models/swig_decoders/scorer.cpp
+0
-0
models/swig_decoders/scorer.h
models/swig_decoders/scorer.h
+0
-0
models/swig_decoders/setup.py
models/swig_decoders/setup.py
+0
-0
models/swig_decoders_wrapper.py
models/swig_decoders_wrapper.py
+2
-2
test.py
test.py
+2
-1
未找到文件。
examples/librispeech/generate.sh
浏览文件 @
7d0458c7
...
...
@@ -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
\
...
...
examples/librispeech/run_test.sh
浏览文件 @
7d0458c7
...
...
@@ -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
\
...
...
infer.py
浏览文件 @
7d0458c7
...
...
@@ -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
)
...
...
models/model.py
浏览文件 @
7d0458c7
...
...
@@ -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
,
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
...
...
deploy
/README.md
→
models/swig_decoders
/README.md
浏览文件 @
7d0458c7
文件已移动
deploy
/__init__.py
→
models/swig_decoders
/__init__.py
浏览文件 @
7d0458c7
文件已移动
deploy
/_init_paths.py
→
models/swig_decoders
/_init_paths.py
浏览文件 @
7d0458c7
文件已移动
deploy
/ctc_decoders.cpp
→
models/swig_decoders
/ctc_decoders.cpp
浏览文件 @
7d0458c7
...
...
@@ -10,7 +10,7 @@
#include "fst/fstlib.h"
#include "path_trie.h"
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
)
{
// dimension check
int
num_time_steps
=
probs_seq
.
size
();
...
...
deploy
/ctc_decoders.h
→
models/swig_decoders
/ctc_decoders.h
浏览文件 @
7d0458c7
...
...
@@ -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
...
...
deploy
/decoder_utils.cpp
→
models/swig_decoders
/decoder_utils.cpp
浏览文件 @
7d0458c7
文件已移动
deploy
/decoder_utils.h
→
models/swig_decoders
/decoder_utils.h
浏览文件 @
7d0458c7
文件已移动
deploy
/decoders.i
→
models/swig_decoders
/decoders.i
浏览文件 @
7d0458c7
文件已移动
deploy
/path_trie.cpp
→
models/swig_decoders
/path_trie.cpp
浏览文件 @
7d0458c7
文件已移动
deploy
/path_trie.h
→
models/swig_decoders
/path_trie.h
浏览文件 @
7d0458c7
文件已移动
deploy
/scorer.cpp
→
models/swig_decoders
/scorer.cpp
浏览文件 @
7d0458c7
文件已移动
deploy
/scorer.h
→
models/swig_decoders
/scorer.h
浏览文件 @
7d0458c7
文件已移动
deploy
/setup.py
→
models/swig_decoders
/setup.py
浏览文件 @
7d0458c7
文件已移动
deploy
/swig_decoders_wrapper.py
→
models
/swig_decoders_wrapper.py
浏览文件 @
7d0458c7
...
...
@@ -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
,
...
...
test.py
浏览文件 @
7d0458c7
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录