-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathdownload_models.py
75 lines (60 loc) · 2.14 KB
/
download_models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
Python script to download the ai models
needed by linguflex from Huggingface's model hub.
"""
from huggingface_hub import hf_hub_download
import os
def create_directory(path):
if not os.path.exists(path):
os.makedirs(path)
def create_directories():
create_directory("models")
create_directory("models/llm")
create_directory("models/rvc")
create_directory("models/rvc/assets")
create_directory("models/rvc/assets/hubert")
create_directory("models/rvc/models")
create_directory("models/xtts")
create_directory("models/xtts/Lasinya")
def download_file(
url,
filename_server,
path_local
):
local_file = os.path.join(path_local, filename_server)
if os.path.exists(local_file):
print(f"File {filename_server} already exists in {path_local}.")
return
print(f"Downloading {filename_server} from repo {url} to {path_local}")
hf_hub_download(
repo_id=url,
filename=filename_server,
local_dir=path_local)
create_directories()
# download default local llm file
# print("Downloading default local llm model file")
# download_file(
# "TheBloke/OpenHermes-2.5-Mistral-7B-GGUF",
# "openhermes-2.5-mistral-7b.Q5_K_M.gguf", "models/llm")
# download rvc base model (hubert) files
print("Downloading hubert base model files")
download_file(
"KoljaB/RVC_Assets", "hubert_base.pt", "models/rvc/assets/hubert")
download_file(
"KoljaB/RVC_Assets", "hubert_inputs.pth", "models/rvc/assets/hubert")
# download rvc trained model files
print("Downloading rvc trained model files")
download_file(
"KoljaB/RVC_Models", "Lasinya.pth", "models/rvc/models")
download_file(
"KoljaB/RVC_Models", "Lasinya.index", "models/rvc/models")
# download xtts trained model files
print("Downloading xtts trained model files (Lasinya)")
download_file(
"KoljaB/XTTS_Lasinya", "config.json", "models/xtts/Lasinya")
download_file(
"KoljaB/XTTS_Lasinya", "vocab.json", "models/xtts/Lasinya")
download_file(
"KoljaB/XTTS_Lasinya", "speakers_xtts.pth", "models/xtts/Lasinya")
download_file(
"KoljaB/XTTS_Lasinya", "model.pth", "models/xtts/Lasinya")