Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-08-03 11:19:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-08-03 11:19:02 +0800
Commit
561d04dd9211576cc10ac288c3bdb1c442964fb2
561d04dd
1 parent
35c1b4a7
describe how to add new words for MeloTTS models (#1209)
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
45 行增加
和
1 行删除
.github/workflows/export-melo-tts-to-onnx.yaml
scripts/melo-tts/export-onnx.py
.github/workflows/export-melo-tts-to-onnx.yaml
查看文件 @
561d04d
...
...
@@ -87,6 +87,8 @@ jobs:
git status
git diff
git commit -m "add models"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/vits-melo-tts-zh_en main || true
...
...
scripts/melo-tts/export-onnx.py
查看文件 @
561d04d
...
...
@@ -78,10 +78,52 @@ def generate_tokens(symbol_list):
f
.
write
(
f
"{s} {i}
\n
"
)
def
add_new_english_words
(
lexicon
):
"""
Args:
lexicon:
Please modify it in-place.
"""
# Please have a look at
# https://github.com/myshell-ai/MeloTTS/blob/main/melo/text/cmudict.rep
# We give several examples below about how to add new words
# Example 1. Add a new word kaldi
# It does not contain the word kaldi in cmudict.rep
# so if we add the following line to cmudict.rep
#
# KALDI K AH0 - L D IH0
#
# then we need to change the lexicon like below
lexicon
[
"kaldi"
]
=
[[
"K"
,
"AH0"
],
[
"L"
,
"D"
,
"IH0"
]]
#
# K AH0 and L D IH0 are separated by a dash "-", so
# ["K", "AH0"] is a in list and ["L", "D", "IH0"] is in a separate list
# Note: Either kaldi or KALDI is fine. You can use either lowercase or
# uppercase or both
# Example 2. Add a new word SF
#
# If we add the following line to cmudict.rep
#
# SF EH1 S - EH1 F
#
# to cmudict.rep, then we need to change the lexicon like below:
lexicon
[
"SF"
]
=
[[
"EH1"
,
"S"
],
[
"EH1"
,
"F"
]]
# Please add your new words here
# No need to return lexicon since it is changed in-place
def
generate_lexicon
():
word_dict
=
pinyin_dict
.
pinyin_dict
phrases
=
phrases_dict
.
phrases_dict
eng_dict
[
"kaldi"
]
=
[[
"K"
,
"AH0"
],
[
"L"
,
"D"
,
"IH0"
]]
add_new_english_words
(
eng_dict
)
with
open
(
"lexicon.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
for
word
in
eng_dict
:
phones
,
tones
=
refine_syllables
(
eng_dict
[
word
])
...
...
请
注册
或
登录
后发表评论