csukuangfj
commited on
Commit
•
0c31dc5
1
Parent(s):
d556fd2
update
Browse files- CMU-in-IPA.zip +0 -3
- en_US-libritts-high.onnx +2 -2
- lexicon.txt +0 -3
- tokens.txt +0 -130
- vits-piper-en_US.py +67 -0
- vits-piper-en_US.sh +21 -0
CMU-in-IPA.zip
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:8235d0aef35db62bdcf6a701fb91ec17b02ab72223b27aaea53476488cdae7fe
|
3 |
-
size 879147
|
|
|
|
|
|
|
|
en_US-libritts-high.onnx
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c6c0eeb0bf6aa67875dd1d2b37d014357dee2aba96f5481686da522dc6b0b93a
|
3 |
+
size 136673944
|
lexicon.txt
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:b2d66e0ac92e0003805047814a220ef9592b527b99806e5e1a3745dc436d70c6
|
3 |
-
size 36727361
|
|
|
|
|
|
|
|
tokens.txt
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
_ 0
|
2 |
-
^ 1
|
3 |
-
$ 2
|
4 |
-
3
|
5 |
-
! 4
|
6 |
-
' 5
|
7 |
-
( 6
|
8 |
-
) 7
|
9 |
-
, 8
|
10 |
-
- 9
|
11 |
-
. 10
|
12 |
-
: 11
|
13 |
-
; 12
|
14 |
-
? 13
|
15 |
-
a 14
|
16 |
-
b 15
|
17 |
-
c 16
|
18 |
-
d 17
|
19 |
-
e 18
|
20 |
-
f 19
|
21 |
-
h 20
|
22 |
-
i 21
|
23 |
-
j 22
|
24 |
-
k 23
|
25 |
-
l 24
|
26 |
-
m 25
|
27 |
-
n 26
|
28 |
-
o 27
|
29 |
-
p 28
|
30 |
-
q 29
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
|
3 |
+
import json
|
4 |
+
import os
|
5 |
+
import re
|
6 |
+
from typing import Any, Dict
|
7 |
+
|
8 |
+
import onnx
|
9 |
+
|
10 |
+
|
11 |
+
def add_meta_data(filename: str, meta_data: Dict[str, Any]):
|
12 |
+
"""Add meta data to an ONNX model. It is changed in-place.
|
13 |
+
|
14 |
+
Args:
|
15 |
+
filename:
|
16 |
+
Filename of the ONNX model to be changed.
|
17 |
+
meta_data:
|
18 |
+
Key-value pairs.
|
19 |
+
"""
|
20 |
+
model = onnx.load(filename)
|
21 |
+
for key, value in meta_data.items():
|
22 |
+
meta = model.metadata_props.add()
|
23 |
+
meta.key = key
|
24 |
+
meta.value = str(value)
|
25 |
+
|
26 |
+
onnx.save(model, filename)
|
27 |
+
|
28 |
+
|
29 |
+
def load_config(model):
|
30 |
+
with open(f"{model}.json", "r") as file:
|
31 |
+
config = json.load(file)
|
32 |
+
return config
|
33 |
+
|
34 |
+
|
35 |
+
# for en_US-lessac-medium.onnx
|
36 |
+
# export TYPE=lessac
|
37 |
+
# export NAME=medium
|
38 |
+
def main():
|
39 |
+
t = os.environ.get("TYPE", None)
|
40 |
+
if not t:
|
41 |
+
print("Please provide the environment variable TYPE")
|
42 |
+
return
|
43 |
+
|
44 |
+
# thorsten or thorsten_emotional
|
45 |
+
name = os.environ.get("NAME", None)
|
46 |
+
if not t:
|
47 |
+
print("Please provide the environment variable NAME")
|
48 |
+
return
|
49 |
+
print("type", t)
|
50 |
+
|
51 |
+
config = load_config(f"en_US-{name}-{t}.onnx")
|
52 |
+
|
53 |
+
print("add model metadata")
|
54 |
+
meta_data = {
|
55 |
+
"model_type": "vits",
|
56 |
+
"comment": "piper", # must be piper for models from piper
|
57 |
+
"language": "English",
|
58 |
+
"voice": config["espeak"]["voice"], # e.g., en-us
|
59 |
+
"has_espeak": int("espeak" in config),
|
60 |
+
"n_speakers": config["num_speakers"],
|
61 |
+
"sample_rate": config["audio"]["sample_rate"],
|
62 |
+
}
|
63 |
+
print(meta_data)
|
64 |
+
add_meta_data(f"en_US-{name}-{t}.onnx", meta_data)
|
65 |
+
|
66 |
+
|
67 |
+
main()
|
vits-piper-en_US.sh
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
|
3 |
+
name=$NAME
|
4 |
+
echo "name: $name"
|
5 |
+
|
6 |
+
type=$TYPE
|
7 |
+
echo "type: $type"
|
8 |
+
|
9 |
+
set -ex
|
10 |
+
|
11 |
+
# for en_US-lessac-medium.onnx
|
12 |
+
# export TYPE=lessac
|
13 |
+
# export NAME=medium
|
14 |
+
|
15 |
+
wget -qq https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/$name/$type/en_US-$name-$type.onnx
|
16 |
+
wget -qq https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/$name/$type/en_US-$name-$type.onnx.json
|
17 |
+
wget -qq https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/$name/$type/MODEL_CARD
|
18 |
+
|
19 |
+
pip install piper-phonemize onnx onnxruntime==1.16.0
|
20 |
+
|
21 |
+
python3 ./vits-piper-en_US.py
|