Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
d7f5ee66
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看板
提交
d7f5ee66
编写于
7月 05, 2017
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
follow comments in code format
上级
eec7cb48
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
16 deletion
+10
-16
deep_speech_2/decoder.py
deep_speech_2/decoder.py
+4
-8
deep_speech_2/evaluate.py
deep_speech_2/evaluate.py
+2
-2
deep_speech_2/infer.py
deep_speech_2/infer.py
+1
-1
deep_speech_2/lm/lm_scorer.py
deep_speech_2/lm/lm_scorer.py
+2
-4
deep_speech_2/tune.py
deep_speech_2/tune.py
+1
-1
未找到文件。
deep_speech_2/decoder.py
浏览文件 @
d7f5ee66
...
...
@@ -5,6 +5,7 @@ from __future__ import print_function
from
itertools
import
groupby
import
numpy
as
np
from
math
import
log
import
multiprocessing
...
...
@@ -97,13 +98,8 @@ def ctc_beam_search_decoder(probs_seq,
# prefix_set_prev: the set containing selected prefixes
# probs_b_prev: prefixes' probability ending with blank in previous step
# probs_nb_prev: prefixes' probability ending with non-blank in previous step
prefix_set_prev
,
probs_b_prev
,
probs_nb_prev
=
{
'
\t
'
:
1.0
},
{
'
\t
'
:
1.0
},
{
'
\t
'
:
0.0
}
prefix_set_prev
=
{
'
\t
'
:
1.0
}
probs_b_prev
,
probs_nb_prev
=
{
'
\t
'
:
1.0
},
{
'
\t
'
:
0.0
}
## extend prefix in loop
for
time_step
in
xrange
(
len
(
probs_seq
)):
...
...
@@ -179,7 +175,7 @@ def ctc_beam_search_decoder(probs_seq,
# score last word by external scorer
if
(
ext_scoring_func
is
not
None
)
and
(
result
[
-
1
]
!=
' '
):
prob
=
prob
*
ext_scoring_func
(
result
)
log_prob
=
np
.
log
(
prob
)
log_prob
=
log
(
prob
)
beam_result
.
append
((
log_prob
,
result
))
## output top beam_size decoding results
...
...
deep_speech_2/evaluate.py
浏览文件 @
d7f5ee66
...
...
@@ -62,7 +62,7 @@ parser.add_argument(
)
parser
.
add_argument
(
"--language_model_path"
,
default
=
"
data/en.00.UNKNOWN
.klm"
,
default
=
"
lm/data/1Billion
.klm"
,
type
=
str
,
help
=
"Path for language model. (default: %(default)s)"
)
parser
.
add_argument
(
...
...
@@ -88,7 +88,7 @@ parser.add_argument(
help
=
"Width for beam search decoding. (default: %(default)d)"
)
parser
.
add_argument
(
"--decode_manifest_path"
,
default
=
'data
/manifest.libri.test-clean
'
,
default
=
'data
sets/manifest.test
'
,
type
=
str
,
help
=
"Manifest path for decoding. (default: %(default)s)"
)
parser
.
add_argument
(
...
...
deep_speech_2/infer.py
浏览文件 @
d7f5ee66
...
...
@@ -89,7 +89,7 @@ parser.add_argument(
help
=
"Number of output per sample in beam search. (default: %(default)d)"
)
parser
.
add_argument
(
"--language_model_path"
,
default
=
"lm/data/
en.00.UNKNOWN
.klm"
,
default
=
"lm/data/
1Billion
.klm"
,
type
=
str
,
help
=
"Path for language model. (default: %(default)s)"
)
parser
.
add_argument
(
...
...
deep_speech_2/lm/lm_scorer.py
浏览文件 @
d7f5ee66
...
...
@@ -62,9 +62,7 @@ class LmScorer(object):
lm
=
self
.
_language_model_score
(
sentence
)
word_cnt
=
self
.
_word_count
(
sentence
)
if
log
==
False
:
score
=
np
.
power
(
lm
,
self
.
_alpha
)
\
*
np
.
power
(
word_cnt
,
self
.
_beta
)
score
=
np
.
power
(
lm
,
self
.
_alpha
)
*
np
.
power
(
word_cnt
,
self
.
_beta
)
else
:
score
=
self
.
_alpha
*
np
.
log
(
lm
)
\
+
self
.
_beta
*
np
.
log
(
word_cnt
)
score
=
self
.
_alpha
*
np
.
log
(
lm
)
+
self
.
_beta
*
np
.
log
(
word_cnt
)
return
score
deep_speech_2/tune.py
浏览文件 @
d7f5ee66
...
...
@@ -77,7 +77,7 @@ parser.add_argument(
help
=
"Width for beam search decoding. (default: %(default)d)"
)
parser
.
add_argument
(
"--language_model_path"
,
default
=
"lm/data/
en.00.UNKNOWN
.klm"
,
default
=
"lm/data/
1Billion
.klm"
,
type
=
str
,
help
=
"Path for language model. (default: %(default)s)"
)
parser
.
add_argument
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录