Spaces:
Runtime error
Runtime error
cocktailpeanut
commited on
Commit
•
e77c996
1
Parent(s):
376a452
update
Browse files- melo/download_utils.py +13 -5
melo/download_utils.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import torch
|
2 |
import os
|
3 |
from . import utils
|
|
|
|
|
|
|
4 |
|
5 |
DOWNLOAD_CKPT_URLS = {
|
6 |
'EN': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN/checkpoint.pth',
|
@@ -25,23 +28,28 @@ DOWNLOAD_CONFIG_URLS = {
|
|
25 |
def load_or_download_config(locale):
|
26 |
language = locale.split('-')[0].upper()
|
27 |
assert language in DOWNLOAD_CONFIG_URLS
|
28 |
-
|
|
|
|
|
29 |
try:
|
30 |
return utils.get_hparams_from_file(config_path)
|
31 |
except:
|
32 |
# download
|
33 |
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
34 |
-
os.system(f'wget {DOWNLOAD_CONFIG_URLS[language]} -O {config_path}')
|
|
|
35 |
return utils.get_hparams_from_file(config_path)
|
36 |
|
37 |
def load_or_download_model(locale, device):
|
38 |
language = locale.split('-')[0].upper()
|
39 |
assert language in DOWNLOAD_CKPT_URLS
|
40 |
-
ckpt_path = os.path.expanduser(f'~/.local/share/openvoice/basespeakers/{language}/checkpoint.pth')
|
|
|
41 |
try:
|
42 |
return torch.load(ckpt_path, map_location=device)
|
43 |
except:
|
44 |
# download
|
45 |
os.makedirs(os.path.dirname(ckpt_path), exist_ok=True)
|
46 |
-
os.system(f'wget {DOWNLOAD_CKPT_URLS[language]} -O {ckpt_path}')
|
47 |
-
|
|
|
|
1 |
import torch
|
2 |
import os
|
3 |
from . import utils
|
4 |
+
current_dir = os.getcwd()
|
5 |
+
_config_path = os.path.join(current_dir, 'openvoice/basespeakers/{language}/config.json')
|
6 |
+
_ckpt_path = os.path.join(current_dir, 'openvoice/basespeakers/{language}/checkpoint.pth')
|
7 |
|
8 |
DOWNLOAD_CKPT_URLS = {
|
9 |
'EN': 'https://myshell-public-repo-hosting.s3.amazonaws.com/openvoice/basespeakers/EN/checkpoint.pth',
|
|
|
28 |
def load_or_download_config(locale):
|
29 |
language = locale.split('-')[0].upper()
|
30 |
assert language in DOWNLOAD_CONFIG_URLS
|
31 |
+
|
32 |
+
#config_path = os.path.expanduser(f'~/.local/share/openvoice/basespeakers/{language}/config.json')
|
33 |
+
config_path = os.path.expanduser(_config_path)
|
34 |
try:
|
35 |
return utils.get_hparams_from_file(config_path)
|
36 |
except:
|
37 |
# download
|
38 |
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
39 |
+
#os.system(f'wget {DOWNLOAD_CONFIG_URLS[language]} -O {config_path}')
|
40 |
+
os.system(f'curl -L {DOWNLOAD_CONFIG_URLS[language]} -O {config_path}')
|
41 |
return utils.get_hparams_from_file(config_path)
|
42 |
|
43 |
def load_or_download_model(locale, device):
|
44 |
language = locale.split('-')[0].upper()
|
45 |
assert language in DOWNLOAD_CKPT_URLS
|
46 |
+
#ckpt_path = os.path.expanduser(f'~/.local/share/openvoice/basespeakers/{language}/checkpoint.pth')
|
47 |
+
ckpt_path = os.path.expanduser(_ckpt_path)
|
48 |
try:
|
49 |
return torch.load(ckpt_path, map_location=device)
|
50 |
except:
|
51 |
# download
|
52 |
os.makedirs(os.path.dirname(ckpt_path), exist_ok=True)
|
53 |
+
#os.system(f'wget {DOWNLOAD_CKPT_URLS[language]} -O {ckpt_path}')
|
54 |
+
os.system(f'curl -L {DOWNLOAD_CKPT_URLS[language]} -O {ckpt_path}')
|
55 |
+
return torch.load(ckpt_path, map_location=device)
|