csukuangfj commited on
Commit
27bee22
1 Parent(s): ffe6dca
Files changed (3) hide show
  1. ne_NP-google-x_low.onnx +2 -2
  2. vits-piper.py +7 -31
  3. vits-piper.sh +2 -0
ne_NP-google-x_low.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0cb0968528f7f20ed492f17e503eb1bf1d7d6210b58c6e3f4873b4c2c55e0ca7
3
- size 27693285
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:758d0568eafb7875b4ab888b0dfc86c41419c04dada2c602bd8aeafcf01ee69f
3
+ size 27693301
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 t:
88
  print("Please provide the environment variable NAME")
89
  return
90
- print("type", t)
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": lang_map[lang],
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