Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
move all nvidia_hifi models
Browse files
app.py
CHANGED
@@ -7,9 +7,33 @@ import threading
|
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
import gradio as gr
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
def run_xvaserver():
|
15 |
# start the process without waiting for a response
|
@@ -42,14 +66,7 @@ def run_xvaserver():
|
|
42 |
xvaserver.wait()
|
43 |
|
44 |
def load_model():
|
45 |
-
|
46 |
-
# model_path = '/tmp/hfcache/models--Pendrokar--xvapitch_nvidia_6670/snapshots/2e138a7c459fb1cb1182dd7bc66813f5325d30fd/ccby_nvidia_hifi_6670_M.pt'
|
47 |
-
# model_json_path = '/tmp/hfcache/models--Pendrokar--xvapitch_nvidia_6670/snapshots/2e138a7c459fb1cb1182dd7bc66813f5325d30fd/ccby_nvidia_hifi_6670_M.json'
|
48 |
-
# try:
|
49 |
-
# os.symlink(model_path, os.path.join('./models/ccby/', os.path.basename(model_path)))
|
50 |
-
# os.symlink(model_json_path, os.path.join('./models/ccby/', os.path.basename(model_json_path)))
|
51 |
-
# except:
|
52 |
-
# print('Failed creating symlinks, they probably already exist')
|
53 |
|
54 |
model_type = 'xVAPitch'
|
55 |
language = 'en'
|
@@ -57,7 +74,7 @@ def load_model():
|
|
57 |
data = {
|
58 |
'outputs': None,
|
59 |
'version': '3.0',
|
60 |
-
'model': model_path
|
61 |
'modelType': model_type,
|
62 |
'base_lang': language,
|
63 |
'pluginsContext': '{}',
|
@@ -72,8 +89,9 @@ def load_model():
|
|
72 |
|
73 |
def predict(input_text, pacing):
|
74 |
|
75 |
-
#
|
76 |
-
#
|
|
|
77 |
|
78 |
model_type = 'xVAPitch'
|
79 |
pace = pacing if pacing else 1.0
|
|
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
import gradio as gr
|
9 |
|
10 |
+
hf_model_name = "Pendrokar/xvapitch_nvidia"
|
11 |
+
hf_cache_models_path = '/tmp/hfcache/models--Pendrokar--xvapitch_nvidia/snapshots/61b10e60b22bc21c1e072f72f1108b9c2b21e94c'
|
12 |
+
|
13 |
+
models_path = './resources/app/models/ccby/'
|
14 |
+
|
15 |
+
voice_models = [
|
16 |
+
"ccby_nvidia_hifi_6670_M",
|
17 |
+
"ccby_nv_hifi_11614_F",
|
18 |
+
"ccby_nvidia_hifi_11697_F",
|
19 |
+
"ccby_nvidia_hifi_12787_F",
|
20 |
+
"ccby_nvidia_hifi_6097_M",
|
21 |
+
"ccby_nvidia_hifi_6671_M",
|
22 |
+
"ccby_nvidia_hifi_8051_F",
|
23 |
+
"ccby_nvidia_hifi_9017_M",
|
24 |
+
"ccby_nvidia_hifi_9136_F",
|
25 |
+
"ccby_nvidia_hifi_92_F",
|
26 |
+
]
|
27 |
+
current_voice_model = None
|
28 |
+
|
29 |
+
# move models to a more persistant place
|
30 |
+
try:
|
31 |
+
for voice_model_name in voice_model_names:
|
32 |
+
os.rename(hf_cache_path +'/'+ voice_model_name + '.pt', models_path + voice_model_name + '.pt')
|
33 |
+
os.rename(hf_cache_path +'/'+ voice_model_name + '.json', models_path + voice_model_name + '.json')
|
34 |
+
os.rename(hf_cache_path +'/'+ voice_model_name + '.wav', models_path + voice_model_name + '.wav')
|
35 |
+
except Exception as e:
|
36 |
+
print('Failed to move downloaded models, perhaps already moved')
|
37 |
|
38 |
def run_xvaserver():
|
39 |
# start the process without waiting for a response
|
|
|
66 |
xvaserver.wait()
|
67 |
|
68 |
def load_model():
|
69 |
+
model_path = models_path + voice_models[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
model_type = 'xVAPitch'
|
72 |
language = 'en'
|
|
|
74 |
data = {
|
75 |
'outputs': None,
|
76 |
'version': '3.0',
|
77 |
+
'model': model_path,
|
78 |
'modelType': model_type,
|
79 |
'base_lang': language,
|
80 |
'pluginsContext': '{}',
|
|
|
89 |
|
90 |
def predict(input_text, pacing):
|
91 |
|
92 |
+
# load voice model if not the current model
|
93 |
+
# if (current_voice_model != voice_model)
|
94 |
+
# load_model()
|
95 |
|
96 |
model_type = 'xVAPitch'
|
97 |
pace = pacing if pacing else 1.0
|