Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
b944418d
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
206
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,发现更多精彩内容 >>
提交
b944418d
编写于
11月 22, 2021
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
new format data support ds2/st
上级
02c7ef31
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
11 deletion
+15
-11
examples/dataset/ted_en_zh/ted_en_zh.py
examples/dataset/ted_en_zh/ted_en_zh.py
+5
-2
examples/ted_en_zh/t0/local/data.sh
examples/ted_en_zh/t0/local/data.sh
+3
-3
paddlespeech/s2t/io/collator.py
paddlespeech/s2t/io/collator.py
+6
-5
paddlespeech/s2t/io/dataset.py
paddlespeech/s2t/io/dataset.py
+1
-1
未找到文件。
examples/dataset/ted_en_zh/ted_en_zh.py
浏览文件 @
b944418d
...
@@ -72,14 +72,17 @@ def create_manifest(data_dir, manifest_path_prefix):
...
@@ -72,14 +72,17 @@ def create_manifest(data_dir, manifest_path_prefix):
continue
continue
audio_data
,
samplerate
=
soundfile
.
read
(
audio_path
)
audio_data
,
samplerate
=
soundfile
.
read
(
audio_path
)
duration
=
float
(
len
(
audio_data
)
/
samplerate
)
duration
=
float
(
len
(
audio_data
)
/
samplerate
)
translation_str
=
" "
.
join
(
translation
.
split
())
trancription_str
=
" "
.
join
(
trancription
.
split
())
json_lines
.
append
(
json_lines
.
append
(
json
.
dumps
(
json
.
dumps
(
{
{
'utt'
:
utt
,
'utt'
:
utt
,
'feat'
:
audio_path
,
'feat'
:
audio_path
,
'feat_shape'
:
(
duration
,
),
# second
'feat_shape'
:
(
duration
,
),
# second
'text'
:
" "
.
join
(
translation
.
split
()),
'text'
:
[
translation_str
,
trancription_str
],
'text1'
:
" "
.
join
(
trancription
.
split
())
},
},
ensure_ascii
=
False
))
ensure_ascii
=
False
))
...
...
examples/ted_en_zh/t0/local/data.sh
浏览文件 @
b944418d
...
@@ -9,7 +9,7 @@ stop_stage=100
...
@@ -9,7 +9,7 @@ stop_stage=100
nbpe
=
8000
nbpe
=
8000
bpemode
=
unigram
bpemode
=
unigram
bpeprefix
=
"data/bpe_
${
bpemode
}
_
${
nbpe
}
"
bpeprefix
=
"data/bpe_
${
bpemode
}
_
${
nbpe
}
"
data_dir
=
./TED
_En
Zh
data_dir
=
./TED
-En-
Zh
source
${
MAIN_ROOT
}
/utils/parse_options.sh
source
${
MAIN_ROOT
}
/utils/parse_options.sh
...
@@ -21,7 +21,7 @@ mkdir -p data
...
@@ -21,7 +21,7 @@ mkdir -p data
if
[
${
stage
}
-le
-1
]
&&
[
${
stop_stage
}
-ge
-1
]
;
then
if
[
${
stage
}
-le
-1
]
&&
[
${
stop_stage
}
-ge
-1
]
;
then
if
[
!
-e
${
data_dir
}
]
;
then
if
[
!
-e
${
data_dir
}
]
;
then
echo
"Error: Dataset is not avaiable. Please download and unzip the dataset"
echo
"Error:
${
data_dir
}
Dataset is not avaiable. Please download and unzip the dataset"
echo
"Download Link: https://pan.baidu.com/s/18L-59wgeS96WkObISrytQQ Passwd: bva0"
echo
"Download Link: https://pan.baidu.com/s/18L-59wgeS96WkObISrytQQ Passwd: bva0"
echo
"The tree of the directory should be:"
echo
"The tree of the directory should be:"
echo
"."
echo
"."
...
@@ -88,7 +88,7 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
...
@@ -88,7 +88,7 @@ if [ ${stage} -le 2 ] && [ ${stop_stage} -ge 2 ]; then
# format manifest with tokenids, vocab size
# format manifest with tokenids, vocab size
for
set
in
train dev
test
;
do
for
set
in
train dev
test
;
do
{
{
python3
${
MAIN_ROOT
}
/utils/format_
triplet_
data.py
\
python3
${
MAIN_ROOT
}
/utils/format_data.py
\
--cmvn_path
"data/mean_std.json"
\
--cmvn_path
"data/mean_std.json"
\
--unit_type
"spm"
\
--unit_type
"spm"
\
--spm_model_prefix
${
bpeprefix
}
\
--spm_model_prefix
${
bpeprefix
}
\
...
...
paddlespeech/s2t/io/collator.py
浏览文件 @
b944418d
...
@@ -237,8 +237,8 @@ class SpeechCollatorBase():
...
@@ -237,8 +237,8 @@ class SpeechCollatorBase():
for
idx
,
item
in
enumerate
(
batch
):
for
idx
,
item
in
enumerate
(
batch
):
utts
.
append
(
item
[
'utt'
])
utts
.
append
(
item
[
'utt'
])
audio
=
item
[
'feat'
]
audio
=
item
[
'
input'
][
0
][
'
feat'
]
text
=
item
[
'text'
]
text
=
item
[
'
output'
][
0
][
'
text'
]
audio
,
text
=
self
.
process_utterance
(
audio
,
text
)
audio
,
text
=
self
.
process_utterance
(
audio
,
text
)
audios
.
append
(
audio
)
# [T, D]
audios
.
append
(
audio
)
# [T, D]
...
@@ -381,9 +381,10 @@ class TripletSpeechCollator(SpeechCollator):
...
@@ -381,9 +381,10 @@ class TripletSpeechCollator(SpeechCollator):
for
idx
,
item
in
enumerate
(
batch
):
for
idx
,
item
in
enumerate
(
batch
):
utts
.
append
(
item
[
'utt'
])
utts
.
append
(
item
[
'utt'
])
audio
=
item
[
'feat'
]
audio
=
item
[
'input'
][
0
][
'feat'
]
translation
=
item
[
'text'
]
translation
=
item
[
'output'
][
0
][
'text'
]
transcription
=
item
[
'text1'
]
transcription
=
item
[
'output'
][
1
][
'text'
]
audio
,
translation
,
transcription
=
self
.
process_utterance
(
audio
,
translation
,
transcription
=
self
.
process_utterance
(
audio
,
translation
,
transcription
)
audio
,
translation
,
transcription
)
...
...
paddlespeech/s2t/io/dataset.py
浏览文件 @
b944418d
...
@@ -122,7 +122,7 @@ class ManifestDataset(Dataset):
...
@@ -122,7 +122,7 @@ class ManifestDataset(Dataset):
min_output_len
=
min_output_len
,
min_output_len
=
min_output_len
,
max_output_input_ratio
=
max_output_input_ratio
,
max_output_input_ratio
=
max_output_input_ratio
,
min_output_input_ratio
=
min_output_input_ratio
)
min_output_input_ratio
=
min_output_input_ratio
)
self
.
_manifest
.
sort
(
key
=
lambda
x
:
x
[
"
feat_
shape"
][
0
])
self
.
_manifest
.
sort
(
key
=
lambda
x
:
x
[
"
input"
][
0
][
"
shape"
][
0
])
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
_manifest
)
return
len
(
self
.
_manifest
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录