Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
49c9cc80
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看板
提交
49c9cc80
编写于
3月 25, 2018
作者:
Y
Yibing Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable decoder in infer_by_ckpt
上级
f029f931
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
3 deletion
+19
-3
fluid/DeepASR/decoder/setup.py
fluid/DeepASR/decoder/setup.py
+1
-0
fluid/DeepASR/infer_by_ckpt.py
fluid/DeepASR/infer_by_ckpt.py
+18
-3
未找到文件。
fluid/DeepASR/decoder/setup.py
浏览文件 @
49c9cc80
...
@@ -45,6 +45,7 @@ LIB_DIRS = [
...
@@ -45,6 +45,7 @@ LIB_DIRS = [
'src/hmm'
,
'src/fstext'
,
'src/decoder'
,
'src/lat'
'src/hmm'
,
'src/fstext'
,
'src/decoder'
,
'src/lat'
]
]
LIB_DIRS
=
[
os
.
path
.
join
(
kaldi_root
,
path
)
for
path
in
LIB_DIRS
]
LIB_DIRS
=
[
os
.
path
.
join
(
kaldi_root
,
path
)
for
path
in
LIB_DIRS
]
LIB_DIRS
=
[
os
.
path
.
abspath
(
path
)
for
path
in
LIB_DIRS
]
ext_modules
=
[
ext_modules
=
[
Extension
(
Extension
(
...
...
fluid/DeepASR/infer_by_ckpt.py
浏览文件 @
49c9cc80
...
@@ -13,7 +13,7 @@ import data_utils.augmentor.trans_mean_variance_norm as trans_mean_variance_norm
...
@@ -13,7 +13,7 @@ import data_utils.augmentor.trans_mean_variance_norm as trans_mean_variance_norm
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_add_delta
as
trans_add_delta
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.augmentor.trans_splice
as
trans_splice
import
data_utils.async_data_reader
as
reader
import
data_utils.async_data_reader
as
reader
import
decoder.decoder
as
d
ecoder
from
decoder.post_decode_faster
import
D
ecoder
from
data_utils.util
import
lodtensor_to_ndarray
from
data_utils.util
import
lodtensor_to_ndarray
from
model_utils.model
import
stacked_lstmp_model
from
model_utils.model
import
stacked_lstmp_model
from
data_utils.util
import
split_infer_result
from
data_utils.util
import
split_infer_result
...
@@ -81,6 +81,21 @@ def parse_args():
...
@@ -81,6 +81,21 @@ def parse_args():
type
=
str
,
type
=
str
,
default
=
'./checkpoint'
,
default
=
'./checkpoint'
,
help
=
"The checkpoint path to init model. (default: %(default)s)"
)
help
=
"The checkpoint path to init model. (default: %(default)s)"
)
parser
.
add_argument
(
'--vocabulary'
,
type
=
str
,
default
=
'./decoder/graph/words.txt'
,
help
=
"The path to vocabulary. (default: %(default)s)"
)
parser
.
add_argument
(
'--graphs'
,
type
=
str
,
default
=
'./decoder/graph/TLG.fst'
,
help
=
"The path to TLG graphs for decoding. (default: %(default)s)"
)
parser
.
add_argument
(
'--log_prior'
,
type
=
str
,
default
=
"./decoder/logprior"
,
help
=
"The log prior probs for training data. (default: %(default)s)"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
args
return
args
...
@@ -154,8 +169,8 @@ def infer_from_ckpt(args):
...
@@ -154,8 +169,8 @@ def infer_from_ckpt(args):
probs
,
lod
=
lodtensor_to_ndarray
(
results
[
0
])
probs
,
lod
=
lodtensor_to_ndarray
(
results
[
0
])
infer_batch
=
split_infer_result
(
probs
,
lod
)
infer_batch
=
split_infer_result
(
probs
,
lod
)
for
index
,
sample
in
enumerate
(
infer_batch
):
for
index
,
sample
in
enumerate
(
infer_batch
):
print
(
"Decoding %d: "
%
(
batch_id
*
args
.
batch_size
+
index
),
key
=
"utter#%d"
%
(
batch_id
*
args
.
batch_size
+
index
)
decoder
.
decode
(
sample
)
)
print
(
key
,
": "
,
decoder
.
decode
(
key
,
sample
),
"
\n
"
)
print
(
np
.
mean
(
infer_costs
),
np
.
mean
(
infer_accs
))
print
(
np
.
mean
(
infer_costs
),
np
.
mean
(
infer_accs
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录