csukuangfj
commited on
Commit
•
f83c851
1
Parent(s):
45c4792
update
Browse files- vits-piper.py +7 -31
- vits-piper.sh +2 -0
vits-piper.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
from typing import Any, Dict
|
6 |
|
7 |
import onnx
|
|
|
8 |
|
9 |
|
10 |
def add_meta_data(filename: str, meta_data: Dict[str, Any]):
|
@@ -39,34 +40,6 @@ def generate_tokens(config):
|
|
39 |
print("Generated tokens.txt")
|
40 |
|
41 |
|
42 |
-
lang_map = {
|
43 |
-
"da_DK": "Danish",
|
44 |
-
"el_GR": "Greek",
|
45 |
-
"fi_FI": "Finnish",
|
46 |
-
"hu_HU": "Hungarian",
|
47 |
-
"is_IS": "Icelandic",
|
48 |
-
"it_IT": "Italian",
|
49 |
-
"ka_GE": "Georgian",
|
50 |
-
"kk_KZ": "Kazakh",
|
51 |
-
"lb_LU": "Luxembourgish",
|
52 |
-
"ne_NP": "Nepali",
|
53 |
-
"nl_BE": "Dutch",
|
54 |
-
"nl_NL": "Dutch",
|
55 |
-
"no_NO": "Norwegian",
|
56 |
-
"pl_PL": "Polish",
|
57 |
-
"pt_BR": "Portuguese",
|
58 |
-
"pt_PT": "Portuguese",
|
59 |
-
"ro_RO": "Romanian",
|
60 |
-
"sk_SK": "Slovak",
|
61 |
-
"sr_RS": "Serbian",
|
62 |
-
"sv_SE": "Swedish",
|
63 |
-
"sw_CD": "Swahili",
|
64 |
-
"tr_TR": "Turkish",
|
65 |
-
"vi_VN": "Vietnamese",
|
66 |
-
"zh_CN": "Chinese",
|
67 |
-
}
|
68 |
-
|
69 |
-
|
70 |
# for en_US-lessac-medium.onnx
|
71 |
# export LANG=en_US
|
72 |
# export TYPE=lessac
|
@@ -76,18 +49,21 @@ def main():
|
|
76 |
if not lang:
|
77 |
print("Please provide the environment variable LANG")
|
78 |
return
|
|
|
|
|
79 |
|
80 |
t = os.environ.get("TYPE", None)
|
81 |
if not t:
|
82 |
print("Please provide the environment variable TYPE")
|
83 |
return
|
|
|
84 |
|
85 |
# thorsten or thorsten_emotional
|
86 |
name = os.environ.get("NAME", None)
|
87 |
-
if not
|
88 |
print("Please provide the environment variable NAME")
|
89 |
return
|
90 |
-
print("
|
91 |
|
92 |
config = load_config(f"{lang}-{name}-{t}.onnx")
|
93 |
|
@@ -98,7 +74,7 @@ def main():
|
|
98 |
meta_data = {
|
99 |
"model_type": "vits",
|
100 |
"comment": "piper", # must be piper for models from piper
|
101 |
-
"language":
|
102 |
"voice": config["espeak"]["voice"], # e.g., en-us
|
103 |
"has_espeak": 1,
|
104 |
"n_speakers": config["num_speakers"],
|
|
|
5 |
from typing import Any, Dict
|
6 |
|
7 |
import onnx
|
8 |
+
from iso639 import Lang
|
9 |
|
10 |
|
11 |
def add_meta_data(filename: str, meta_data: Dict[str, Any]):
|
|
|
40 |
print("Generated tokens.txt")
|
41 |
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
# for en_US-lessac-medium.onnx
|
44 |
# export LANG=en_US
|
45 |
# export TYPE=lessac
|
|
|
49 |
if not lang:
|
50 |
print("Please provide the environment variable LANG")
|
51 |
return
|
52 |
+
lang_iso = Lang(lang.split("_")[0])
|
53 |
+
print(lang, lang_iso)
|
54 |
|
55 |
t = os.environ.get("TYPE", None)
|
56 |
if not t:
|
57 |
print("Please provide the environment variable TYPE")
|
58 |
return
|
59 |
+
print("type", t)
|
60 |
|
61 |
# thorsten or thorsten_emotional
|
62 |
name = os.environ.get("NAME", None)
|
63 |
+
if not name:
|
64 |
print("Please provide the environment variable NAME")
|
65 |
return
|
66 |
+
print("name", name)
|
67 |
|
68 |
config = load_config(f"{lang}-{name}-{t}.onnx")
|
69 |
|
|
|
74 |
meta_data = {
|
75 |
"model_type": "vits",
|
76 |
"comment": "piper", # must be piper for models from piper
|
77 |
+
"language": lang_iso.name,
|
78 |
"voice": config["espeak"]["voice"], # e.g., en-us
|
79 |
"has_espeak": 1,
|
80 |
"n_speakers": config["num_speakers"],
|
vits-piper.sh
CHANGED
@@ -14,6 +14,8 @@ echo "name: $name"
|
|
14 |
type=$TYPE
|
15 |
echo "type: $type"
|
16 |
|
|
|
|
|
17 |
set -ex
|
18 |
|
19 |
# for en_US-lessac-medium.onnx
|
|
|
14 |
type=$TYPE
|
15 |
echo "type: $type"
|
16 |
|
17 |
+
pip install iso639-lang
|
18 |
+
|
19 |
set -ex
|
20 |
|
21 |
# for en_US-lessac-medium.onnx
|