Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
8f062cad
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
1 年多 前同步成功
通知
207
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看板
提交
8f062cad
编写于
8月 04, 2021
作者:
H
huangyuxin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed the small problems
上级
3fb9f688
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
12 addition
and
62 deletion
+12
-62
deepspeech/exps/deepspeech2/bin/export.py
deepspeech/exps/deepspeech2/bin/export.py
+1
-0
deepspeech/exps/deepspeech2/bin/test.py
deepspeech/exps/deepspeech2/bin/test.py
+1
-0
deepspeech/exps/deepspeech2/bin/train.py
deepspeech/exps/deepspeech2/bin/train.py
+1
-0
deepspeech/exps/deepspeech2/config.py
deepspeech/exps/deepspeech2/config.py
+4
-16
deepspeech/exps/deepspeech2/model.py
deepspeech/exps/deepspeech2/model.py
+0
-1
deepspeech/models/ds2_online/deepspeech2.py
deepspeech/models/ds2_online/deepspeech2.py
+2
-1
examples/tiny/s0/local/export.sh
examples/tiny/s0/local/export.sh
+1
-1
examples/tiny/s0/local/test.sh
examples/tiny/s0/local/test.sh
+1
-1
examples/tiny/s0/local/train.sh
examples/tiny/s0/local/train.sh
+1
-1
examples/tiny/s0/run_online.sh
examples/tiny/s0/run_online.sh
+0
-41
未找到文件。
deepspeech/exps/deepspeech2/bin/export.py
浏览文件 @
8f062cad
...
...
@@ -34,6 +34,7 @@ if __name__ == "__main__":
args
=
parser
.
parse_args
()
if
args
.
model_type
is
None
:
args
.
model_type
=
'offline'
print
(
"model_type:{}"
.
format
(
args
.
model_type
))
print_arguments
(
args
)
# https://yaml.org/type/float.html
...
...
deepspeech/exps/deepspeech2/bin/test.py
浏览文件 @
8f062cad
...
...
@@ -35,6 +35,7 @@ if __name__ == "__main__":
print_arguments
(
args
,
globals
())
if
args
.
model_type
is
None
:
args
.
model_type
=
'offline'
print
(
"model_type:{}"
.
format
(
args
.
model_type
))
# https://yaml.org/type/float.html
config
=
get_cfg_defaults
(
args
.
model_type
)
...
...
deepspeech/exps/deepspeech2/bin/train.py
浏览文件 @
8f062cad
...
...
@@ -39,6 +39,7 @@ if __name__ == "__main__":
args
=
parser
.
parse_args
()
if
args
.
model_type
is
None
:
args
.
model_type
=
'offline'
print
(
"model_type:{}"
.
format
(
args
.
model_type
))
print_arguments
(
args
,
globals
())
# https://yaml.org/type/float.html
...
...
deepspeech/exps/deepspeech2/config.py
浏览文件 @
8f062cad
...
...
@@ -23,26 +23,14 @@ from deepspeech.models.ds2_online import DeepSpeech2ModelOnline
def
get_cfg_defaults
(
model_type
=
'offline'
):
_C
=
CfgNode
()
_C
.
data
=
ManifestDataset
.
params
()
_C
.
collator
=
SpeechCollator
.
params
()
_C
.
training
=
DeepSpeech2Trainer
.
params
()
_C
.
decoding
=
DeepSpeech2Tester
.
params
()
if
(
model_type
==
'offline'
):
_C
.
data
=
ManifestDataset
.
params
()
_C
.
collator
=
SpeechCollator
.
params
()
_C
.
model
=
DeepSpeech2Model
.
params
()
_C
.
training
=
DeepSpeech2Trainer
.
params
()
_C
.
decoding
=
DeepSpeech2Tester
.
params
()
else
:
_C
.
data
=
ManifestDataset
.
params
()
_C
.
collator
=
SpeechCollator
.
params
()
_C
.
model
=
DeepSpeech2ModelOnline
.
params
()
_C
.
training
=
DeepSpeech2Trainer
.
params
()
_C
.
decoding
=
DeepSpeech2Tester
.
params
()
"""Get a yacs CfgNode object with default values for my_project."""
# Return a clone so that the defaults will not be altered
# This is for the "local variable" use pattern
...
...
deepspeech/exps/deepspeech2/model.py
浏览文件 @
8f062cad
...
...
@@ -134,7 +134,6 @@ class DeepSpeech2Trainer(Trainer):
use_gru
=
config
.
model
.
use_gru
,
share_rnn_weights
=
config
.
model
.
share_rnn_weights
)
elif
self
.
args
.
model_type
==
'online'
:
print
(
"fc_layers_size_list"
,
config
.
model
.
fc_layers_size_list
)
model
=
DeepSpeech2ModelOnline
(
feat_size
=
self
.
train_loader
.
collate_fn
.
feature_size
,
dict_size
=
self
.
train_loader
.
collate_fn
.
vocab_size
,
...
...
deepspeech/models/ds2_online/deepspeech2.py
浏览文件 @
8f062cad
...
...
@@ -174,6 +174,7 @@ class CRNNEncoder(nn.Layer):
num_chunk
=
(
max_len
+
padding_len
-
chunk_size
)
/
chunk_stride
+
1
num_chunk
=
int
(
num_chunk
)
chunk_state_list
=
[
None
]
*
self
.
num_rnn_layers
final_chunk_state_list
=
None
for
i
in
range
(
0
,
num_chunk
):
start
=
i
*
chunk_stride
end
=
start
+
chunk_size
...
...
@@ -366,4 +367,4 @@ class DeepSpeech2InferModelOnline(DeepSpeech2ModelOnline):
eouts_chunk
,
eouts_chunk_lens
,
final_state_list
=
self
.
encoder
.
forward_chunk
(
audio_chunk
,
audio_chunk_lens
,
chunk_state_list
)
probs_chunk
=
self
.
decoder
.
softmax
(
eouts_chunk
)
return
probs_chunk
,
final_state_list
return
probs_chunk
,
eouts_chunk_lens
,
final_state_list
examples/tiny/s0/local/export.sh
浏览文件 @
8f062cad
#!/bin/bash
if
[
$#
!=
4
]
;
then
echo
"usage:
$0
config_path ckpt_prefix jit_model_path"
echo
"usage:
$0
config_path ckpt_prefix jit_model_path
model_type
"
exit
-1
fi
...
...
examples/tiny/s0/local/test.sh
浏览文件 @
8f062cad
#!/bin/bash
if
[
$#
!=
3
]
;
then
echo
"usage:
${
0
}
config_path ckpt_path_prefix"
echo
"usage:
${
0
}
config_path ckpt_path_prefix
model_type
"
exit
-1
fi
...
...
examples/tiny/s0/local/train.sh
浏览文件 @
8f062cad
#!/bin/bash
if
[
$#
!=
3
]
;
then
echo
"usage: CUDA_VISIBLE_DEVICES=0
${
0
}
config_path ckpt_name"
echo
"usage: CUDA_VISIBLE_DEVICES=0
${
0
}
config_path ckpt_name
model_type
"
exit
-1
fi
...
...
examples/tiny/s0/run_online.sh
已删除
100755 → 0
浏览文件 @
3fb9f688
#!/bin/bash
set
-e
source
path.sh
gpus
=
7
stage
=
1
stop_stage
=
1
conf_path
=
conf/deepspeech2_online.yaml
avg_num
=
1
model_type
=
online
#online | offline
source
${
MAIN_ROOT
}
/utils/parse_options.sh
||
exit
1
;
avg_ckpt
=
avg_
${
avg_num
}
ckpt
=
$(
basename
${
conf_path
}
|
awk
-F
'.'
'{print $1}'
)
###ckpt = deepspeech2
echo
"checkpoint name
${
ckpt
}
"
if
[
${
stage
}
-le
0
]
&&
[
${
stop_stage
}
-ge
0
]
;
then
# prepare data
bash ./local/data.sh
||
exit
-1
fi
if
[
${
stage
}
-le
1
]
&&
[
${
stop_stage
}
-ge
1
]
;
then
# train model, all `ckpt` under `exp` dir
CUDA_VISIBLE_DEVICES
=
${
gpus
}
./local/train.sh
${
conf_path
}
${
ckpt
}
${
model_type
}
fi
if
[
${
stage
}
-le
2
]
&&
[
${
stop_stage
}
-ge
2
]
;
then
# avg n best model
avg.sh exp/
${
ckpt
}
/checkpoints
${
avg_num
}
fi
if
[
${
stage
}
-le
3
]
&&
[
${
stop_stage
}
-ge
3
]
;
then
# test ckpt avg_n
CUDA_VISIBLE_DEVICES
=
${
gpus
}
./local/test.sh
${
conf_path
}
exp/
${
ckpt
}
/checkpoints/
${
avg_ckpt
}
${
model_type
}
||
exit
-1
fi
if
[
${
stage
}
-le
4
]
&&
[
${
stop_stage
}
-ge
4
]
;
then
# export ckpt avg_n
CUDA_VISIBLE_DEVICES
=
${
gpus
}
./local/export.sh
${
conf_path
}
exp/
${
ckpt
}
/checkpoints/
${
avg_ckpt
}
exp/
${
ckpt
}
/checkpoints/
${
avg_ckpt
}
.jit
${
model_type
}
fi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录