Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
9d5eb740
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
1 年多 前同步成功
通知
208
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看板
提交
9d5eb740
编写于
9月 22, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix decode json file
上级
9abe33b4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
22 addition
and
34 deletion
+22
-34
deepspeech/exps/deepspeech2/model.py
deepspeech/exps/deepspeech2/model.py
+2
-2
deepspeech/exps/u2/model.py
deepspeech/exps/u2/model.py
+2
-2
deepspeech/exps/u2_kaldi/model.py
deepspeech/exps/u2_kaldi/model.py
+2
-2
deepspeech/exps/u2_st/model.py
deepspeech/exps/u2_st/model.py
+2
-2
utils/README.md
utils/README.md
+2
-1
utils/dump_manifest.py
utils/dump_manifest.py
+0
-0
utils/filter.py
utils/filter.py
+12
-25
未找到文件。
deepspeech/exps/deepspeech2/model.py
浏览文件 @
9d5eb740
...
...
@@ -18,8 +18,8 @@ from collections import defaultdict
from
contextlib
import
nullcontext
from
pathlib
import
Path
from
typing
import
Optional
import
jsonlines
import
jsonlines
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
...
...
@@ -306,7 +306,7 @@ class DeepSpeech2Tester(DeepSpeech2Trainer):
len_refs
+=
len_ref
num_ins
+=
1
if
fout
:
fout
.
write
({
"utt"
:
utt
,
"ref"
,
target
,
"hyp"
:
result
})
fout
.
write
({
"utt"
:
utt
,
"ref"
:
target
,
"hyp"
:
result
})
logger
.
info
(
f
"Utt:
{
utt
}
"
)
logger
.
info
(
f
"Ref:
{
target
}
"
)
logger
.
info
(
f
"Hyp:
{
result
}
"
)
...
...
deepspeech/exps/u2/model.py
浏览文件 @
9d5eb740
...
...
@@ -21,8 +21,8 @@ from collections import OrderedDict
from
contextlib
import
nullcontext
from
pathlib
import
Path
from
typing
import
Optional
import
jsonlines
import
jsonlines
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
...
...
@@ -467,7 +467,7 @@ class U2Tester(U2Trainer):
len_refs
+=
len_ref
num_ins
+=
1
if
fout
:
fout
.
write
({
"utt"
:
utt
,
"ref"
,
target
,
"hyp"
:
result
})
fout
.
write
({
"utt"
:
utt
,
"ref"
:
target
,
"hyp"
:
result
})
logger
.
info
(
f
"Utt:
{
utt
}
"
)
logger
.
info
(
f
"Ref:
{
target
}
"
)
logger
.
info
(
f
"Hyp:
{
result
}
"
)
...
...
deepspeech/exps/u2_kaldi/model.py
浏览文件 @
9d5eb740
...
...
@@ -20,8 +20,8 @@ from collections import defaultdict
from
contextlib
import
nullcontext
from
pathlib
import
Path
from
typing
import
Optional
import
jsonlines
import
jsonlines
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
...
...
@@ -446,7 +446,7 @@ class U2Tester(U2Trainer):
len_refs
+=
len_ref
num_ins
+=
1
if
fout
:
fout
.
write
({
"utt"
:
utt
,
"ref"
,
target
,
"hyp"
:
result
})
fout
.
write
({
"utt"
:
utt
,
"ref"
:
target
,
"hyp"
:
result
})
logger
.
info
(
f
"Utt:
{
utt
}
"
)
logger
.
info
(
f
"Ref:
{
target
}
"
)
logger
.
info
(
f
"Hyp:
{
result
}
"
)
...
...
deepspeech/exps/u2_st/model.py
浏览文件 @
9d5eb740
...
...
@@ -20,8 +20,8 @@ from collections import defaultdict
from
contextlib
import
nullcontext
from
pathlib
import
Path
from
typing
import
Optional
import
jsonlines
import
jsonlines
import
numpy
as
np
import
paddle
from
paddle
import
distributed
as
dist
...
...
@@ -480,7 +480,7 @@ class U2STTester(U2STTrainer):
len_refs
+=
len
(
target
.
split
())
num_ins
+=
1
if
fout
:
fout
.
write
({
"utt"
:
utt
,
"ref"
,
target
,
"hyp"
:
result
})
fout
.
write
({
"utt"
:
utt
,
"ref"
:
target
,
"hyp"
:
result
})
logger
.
info
(
f
"Utt:
{
utt
}
"
)
logger
.
info
(
f
"Ref:
{
target
}
"
)
logger
.
info
(
f
"Hyp:
{
result
}
"
)
...
...
utils/README.md
浏览文件 @
9d5eb740
# Utils
*
[
kaldi utils
](
https://github.com/kaldi-asr/kaldi/blob/cbed4ff688/egs/wsj/s5/utils
)
\ No newline at end of file
*
[
kaldi utils
](
https://github.com/kaldi-asr/kaldi/blob/cbed4ff688/egs/wsj/s5/utils
)
*
[espnet utils)(https://github.com/espnet/espnet/tree/master/utils)
utils/dump_manifest.py
100644 → 100755
浏览文件 @
9d5eb740
文件模式从 100644 更改为 100755
utils/filter.py
100644 → 100755
浏览文件 @
9d5eb740
#!/usr/bin/env python3
# Apache 2.0
import
argparse
import
codecs
import
sys
...
...
@@ -12,15 +10,13 @@ is_python2 = sys.version_info[0] == 2
def
get_parser
():
parser
=
argparse
.
ArgumentParser
(
description
=
"filter words in a text file"
,
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
)
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
)
parser
.
add_argument
(
"--exclude"
,
"-v"
,
dest
=
"exclude"
,
action
=
"store_true"
,
help
=
"exclude filter words"
,
)
help
=
"exclude filter words"
,
)
parser
.
add_argument
(
"filt"
,
type
=
str
,
help
=
"filter list"
)
parser
.
add_argument
(
"infile"
,
type
=
str
,
help
=
"input file"
)
return
parser
...
...
@@ -37,29 +33,20 @@ def filter_file(infile, filt, exclude):
for
line
in
vocabfile
:
vocab
.
add
(
line
.
strip
())
sys
.
stdout
=
codecs
.
getwriter
(
"utf-8"
)(
sys
.
stdout
if
is_python2
else
sys
.
stdout
.
buffer
)
sys
.
stdout
=
codecs
.
getwriter
(
"utf-8"
)(
sys
.
stdout
if
is_python2
else
sys
.
stdout
.
buffer
)
with
codecs
.
open
(
infile
,
"r"
,
encoding
=
"utf-8"
)
as
textfile
:
for
line
in
textfile
:
if
exclude
:
print
(
" "
.
join
(
map
(
lambda
word
:
word
if
word
not
in
vocab
else
""
,
line
.
strip
().
split
(),
)
)
)
print
(
" "
.
join
(
map
(
lambda
word
:
word
if
word
not
in
vocab
else
""
,
line
.
strip
().
split
(),
)))
else
:
print
(
" "
.
join
(
map
(
lambda
word
:
word
if
word
in
vocab
else
"<UNK>"
,
line
.
strip
().
split
(),
)
)
)
print
(
" "
.
join
(
map
(
lambda
word
:
word
if
word
in
vocab
else
"<UNK>"
,
line
.
strip
().
split
(),
)))
if
__name__
==
"__main__"
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录