Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
42c58daf
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
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看板
提交
42c58daf
编写于
9月 28, 2017
作者:
Y
yangyaming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bugs for demo_server.py.
上级
8dcf1d56
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
2 deletion
+25
-2
deploy/_init_paths.py
deploy/_init_paths.py
+19
-0
deploy/demo_server.py
deploy/demo_server.py
+6
-2
未找到文件。
deploy/_init_paths.py
0 → 100644
浏览文件 @
42c58daf
"""Set up paths for DS2"""
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
)
deploy/demo_server.py
浏览文件 @
42c58daf
...
@@ -12,7 +12,7 @@ import paddle.v2 as paddle
...
@@ -12,7 +12,7 @@ import paddle.v2 as paddle
import
_init_paths
import
_init_paths
from
data_utils.data
import
DataGenerator
from
data_utils.data
import
DataGenerator
from
model_utils.model
import
DeepSpeech2Model
from
model_utils.model
import
DeepSpeech2Model
from
data_utils.util
s
import
read_manifest
from
data_utils.util
ity
import
read_manifest
from
utils.utility
import
add_arguments
,
print_arguments
from
utils.utility
import
add_arguments
,
print_arguments
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
...
@@ -26,6 +26,7 @@ add_arg('rnn_layer_size', int, 2048, "# of recurrent cells per layer.")
...
@@ -26,6 +26,7 @@ add_arg('rnn_layer_size', int, 2048, "# of recurrent cells per layer.")
add_arg
(
'alpha'
,
float
,
0.36
,
"Coef of LM for beam search."
)
add_arg
(
'alpha'
,
float
,
0.36
,
"Coef of LM for beam search."
)
add_arg
(
'beta'
,
float
,
0.25
,
"Coef of WC for beam search."
)
add_arg
(
'beta'
,
float
,
0.25
,
"Coef of WC for beam search."
)
add_arg
(
'cutoff_prob'
,
float
,
0.99
,
"Cutoff probability for pruning."
)
add_arg
(
'cutoff_prob'
,
float
,
0.99
,
"Cutoff probability for pruning."
)
add_arg
(
'cutoff_top_n'
,
int
,
40
,
"Cutoff number for pruning."
)
add_arg
(
'use_gru'
,
bool
,
False
,
"Use GRUs instead of simple RNNs."
)
add_arg
(
'use_gru'
,
bool
,
False
,
"Use GRUs instead of simple RNNs."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Use GPU or not."
)
add_arg
(
'share_rnn_weights'
,
bool
,
True
,
"Share input-hidden weights across "
add_arg
(
'share_rnn_weights'
,
bool
,
True
,
"Share input-hidden weights across "
...
@@ -156,6 +157,8 @@ def start_server():
...
@@ -156,6 +157,8 @@ def start_server():
pretrained_model_path
=
args
.
model_path
,
pretrained_model_path
=
args
.
model_path
,
share_rnn_weights
=
args
.
share_rnn_weights
)
share_rnn_weights
=
args
.
share_rnn_weights
)
vocab_list
=
[
chars
.
encode
(
"utf-8"
)
for
chars
in
data_generator
.
vocab_list
]
# prepare ASR inference handler
# prepare ASR inference handler
def
file_to_transcript
(
filename
):
def
file_to_transcript
(
filename
):
feature
=
data_generator
.
process_utterance
(
filename
,
""
)
feature
=
data_generator
.
process_utterance
(
filename
,
""
)
...
@@ -166,7 +169,8 @@ def start_server():
...
@@ -166,7 +169,8 @@ def start_server():
beam_beta
=
args
.
beta
,
beam_beta
=
args
.
beta
,
beam_size
=
args
.
beam_size
,
beam_size
=
args
.
beam_size
,
cutoff_prob
=
args
.
cutoff_prob
,
cutoff_prob
=
args
.
cutoff_prob
,
vocab_list
=
data_generator
.
vocab_list
,
cutoff_top_n
=
args
.
cutoff_top_n
,
vocab_list
=
vocab_list
,
language_model_path
=
args
.
lang_model_path
,
language_model_path
=
args
.
lang_model_path
,
num_processes
=
1
)
num_processes
=
1
)
return
result_transcript
[
0
]
return
result_transcript
[
0
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录