Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
de0f9915
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看板
提交
de0f9915
编写于
8月 08, 2022
作者:
B
BarryKCL
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change G2PWModel download
上级
744ea442
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
47 deletion
+26
-47
MANIFEST.in
MANIFEST.in
+1
-2
paddlespeech/resource/pretrained_models.py
paddlespeech/resource/pretrained_models.py
+20
-29
paddlespeech/t2s/frontend/g2pw/onnx_api.py
paddlespeech/t2s/frontend/g2pw/onnx_api.py
+5
-16
未找到文件。
MANIFEST.in
浏览文件 @
de0f9915
include paddlespeech/t2s/exps/*.txt
include paddlespeech/t2s/exps/*.txt
include paddlespeech/t2s/frontend/*.yaml
include paddlespeech/t2s/frontend/*.yaml
include paddlespeech/t2s/frontend/g2pw/*.json
\ No newline at end of file
\ No newline at end of file
paddlespeech/resource/pretrained_models.py
浏览文件 @
de0f9915
...
@@ -655,24 +655,6 @@ tts_dynamic_pretrained_models = {
...
@@ -655,24 +655,6 @@ tts_dynamic_pretrained_models = {
'phone_id_map.txt'
,
'phone_id_map.txt'
,
},
},
},
},
"fastspeech2_mix-mix"
:
{
'1.0'
:
{
'url'
:
'https://paddlespeech.bj.bcebos.com/t2s/chinse_english_mixed/models/fastspeech2_csmscljspeech_add-zhen.zip'
,
'md5'
:
'77d9d4b5a79ed6203339ead7ef6c74f9'
,
'config'
:
'default.yaml'
,
'ckpt'
:
'snapshot_iter_94000.pdz'
,
'speech_stats'
:
'speech_stats.npy'
,
'phones_dict'
:
'phone_id_map.txt'
,
'speaker_dict'
:
'speaker_id_map.txt'
,
},
},
# tacotron2
# tacotron2
"tacotron2_csmsc-zh"
:
{
"tacotron2_csmsc-zh"
:
{
'1.0'
:
{
'1.0'
:
{
...
@@ -1095,8 +1077,7 @@ tts_onnx_pretrained_models = {
...
@@ -1095,8 +1077,7 @@ tts_onnx_pretrained_models = {
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/speedyspeech/speedyspeech_csmsc_onnx_0.2.0.zip'
,
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/speedyspeech/speedyspeech_csmsc_onnx_0.2.0.zip'
,
'md5'
:
'md5'
:
'3e9c45af9ef70675fc1968ed5074fc88'
,
'3e9c45af9ef70675fc1968ed5074fc88'
,
'ckpt'
:
'ckpt'
:
[
'speedyspeech_csmsc.onnx'
],
'speedyspeech_csmsc.onnx'
,
'phones_dict'
:
'phones_dict'
:
'phone_id_map.txt'
,
'phone_id_map.txt'
,
'tones_dict'
:
'tones_dict'
:
...
@@ -1112,8 +1093,7 @@ tts_onnx_pretrained_models = {
...
@@ -1112,8 +1093,7 @@ tts_onnx_pretrained_models = {
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_csmsc_onnx_0.2.0.zip'
,
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_csmsc_onnx_0.2.0.zip'
,
'md5'
:
'md5'
:
'fd3ad38d83273ad51f0ea4f4abf3ab4e'
,
'fd3ad38d83273ad51f0ea4f4abf3ab4e'
,
'ckpt'
:
'ckpt'
:
[
'fastspeech2_csmsc.onnx'
],
'fastspeech2_csmsc.onnx'
,
'phones_dict'
:
'phones_dict'
:
'phone_id_map.txt'
,
'phone_id_map.txt'
,
'sample_rate'
:
'sample_rate'
:
...
@@ -1126,8 +1106,7 @@ tts_onnx_pretrained_models = {
...
@@ -1126,8 +1106,7 @@ tts_onnx_pretrained_models = {
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_ljspeech_onnx_1.1.0.zip'
,
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_ljspeech_onnx_1.1.0.zip'
,
'md5'
:
'md5'
:
'00754307636a48c972a5f3e65cda3d18'
,
'00754307636a48c972a5f3e65cda3d18'
,
'ckpt'
:
'ckpt'
:
[
'fastspeech2_ljspeech.onnx'
],
'fastspeech2_ljspeech.onnx'
,
'phones_dict'
:
'phones_dict'
:
'phone_id_map.txt'
,
'phone_id_map.txt'
,
'sample_rate'
:
'sample_rate'
:
...
@@ -1140,8 +1119,7 @@ tts_onnx_pretrained_models = {
...
@@ -1140,8 +1119,7 @@ tts_onnx_pretrained_models = {
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_aishell3_onnx_1.1.0.zip'
,
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_aishell3_onnx_1.1.0.zip'
,
'md5'
:
'md5'
:
'a1d6ee21de897ce394f5469e2bb4df0d'
,
'a1d6ee21de897ce394f5469e2bb4df0d'
,
'ckpt'
:
'ckpt'
:
[
'fastspeech2_aishell3.onnx'
],
'fastspeech2_aishell3.onnx'
,
'phones_dict'
:
'phones_dict'
:
'phone_id_map.txt'
,
'phone_id_map.txt'
,
'speaker_dict'
:
'speaker_dict'
:
...
@@ -1153,11 +1131,10 @@ tts_onnx_pretrained_models = {
...
@@ -1153,11 +1131,10 @@ tts_onnx_pretrained_models = {
"fastspeech2_vctk_onnx-en"
:
{
"fastspeech2_vctk_onnx-en"
:
{
'1.0'
:
{
'1.0'
:
{
'url'
:
'url'
:
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_vctk_onnx_1.1.0.zip'
,
'h
h
ttps://paddlespeech.bj.bcebos.com/Parakeet/released_models/fastspeech2/fastspeech2_vctk_onnx_1.1.0.zip'
,
'md5'
:
'md5'
:
'd9c3a9b02204a2070504dd99f5f959bf'
,
'd9c3a9b02204a2070504dd99f5f959bf'
,
'ckpt'
:
'ckpt'
:
[
'fastspeech2_vctk.onnx'
],
'fastspeech2_vctk.onnx'
,
'phones_dict'
:
'phones_dict'
:
'phone_id_map.txt'
,
'phone_id_map.txt'
,
'speaker_dict'
:
'speaker_dict'
:
...
@@ -1335,3 +1312,17 @@ kws_dynamic_pretrained_models = {
...
@@ -1335,3 +1312,17 @@ kws_dynamic_pretrained_models = {
},
},
},
},
}
}
# ---------------------------------
# ------------- G2PW ---------------
# ---------------------------------
g2pw_onnx_models
=
{
'G2PWModel'
:
{
'1.0'
:
{
'url'
:
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/g2p/G2PWModel.tar'
,
'md5'
:
'86a3dd8db0291c575c46e134111dce23'
,
},
},
}
paddlespeech/t2s/frontend/g2pw/onnx_api.py
浏览文件 @
de0f9915
...
@@ -10,14 +10,14 @@ import numpy as np
...
@@ -10,14 +10,14 @@ import numpy as np
from
opencc
import
OpenCC
from
opencc
import
OpenCC
from
paddlenlp.transformers
import
BertTokenizer
from
paddlenlp.transformers
import
BertTokenizer
from
paddlespeech.utils.env
import
MODEL_HOME
from
paddlespeech.t2s.frontend.g2pw.dataset
import
prepare_data
,
\
from
paddlespeech.t2s.frontend.g2pw.dataset
import
prepare_data
,
\
prepare_onnx_input
,
\
prepare_onnx_input
,
\
get_phoneme_labels
,
\
get_phoneme_labels
,
\
get_char_phoneme_labels
get_char_phoneme_labels
from
paddlespeech.t2s.frontend.g2pw.utils
import
load_config
from
paddlespeech.t2s.frontend.g2pw.utils
import
load_config
from
paddlespeech.cli.utils
import
download_and_decompress
MODEL_URL
=
'https://paddlespeech.bj.bcebos.com/Parakeet/released_models/g2p/G2PWModel.tar'
from
paddlespeech.resource.pretrained_models
import
g2pw_onnx_models
def
predict
(
session
,
onnx_input
,
labels
):
def
predict
(
session
,
onnx_input
,
labels
):
...
@@ -40,21 +40,10 @@ def predict(session, onnx_input, labels):
...
@@ -40,21 +40,10 @@ def predict(session, onnx_input, labels):
return
all_preds
,
all_confidences
return
all_preds
,
all_confidences
def
download_model
(
model_dir
):
os
.
makedirs
(
model_dir
,
exist_ok
=
True
)
wget_shell
=
"cd %s && wget %s"
%
(
model_dir
,
MODEL_URL
)
os
.
system
(
wget_shell
)
shell
=
"cd %s ;tar -xvf %s;cd %s/G2PWModel;rm -rf .*"
%
(
model_dir
,
MODEL_URL
.
split
(
"/"
)[
-
1
],
model_dir
)
os
.
system
(
shell
)
rm_shell
=
"cd %s && rm -rf %s"
%
(
model_dir
,
MODEL_URL
.
split
(
"/"
)[
-
1
])
os
.
system
(
rm_shell
)
class
G2PWOnnxConverter
:
class
G2PWOnnxConverter
:
def
__init__
(
self
,
style
=
'bopomofo'
,
model_source
=
None
,
enable_non_tradional_chinese
=
False
):
def
__init__
(
self
,
model_dir
=
MODEL_HOME
,
style
=
'bopomofo'
,
model_source
=
None
,
enable_non_tradional_chinese
=
False
):
model_dir
=
os
.
path
.
join
(
os
.
path
.
expandvars
(
'$HOME'
),
'paddlespeech/models'
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
model_dir
,
'G2PWModel/g2pW.onnx'
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
model_dir
,
'G2PWModel/g2pW.onnx'
)):
download_model
(
model_dir
)
uncompress_path
=
download_and_decompress
(
g2pw_onnx_models
[
'G2PWModel'
][
'1.0'
],
model_dir
)
sess_options
=
onnxruntime
.
SessionOptions
()
sess_options
=
onnxruntime
.
SessionOptions
()
sess_options
.
intra_op_num_threads
=
2
sess_options
.
intra_op_num_threads
=
2
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录