import os | |
from pathlib import Path | |
import requests | |
RVC_DOWNLOAD_LINK = "https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/" | |
BASE_DIR = Path(__file__).resolve().parent.parent | |
def dl_model(link, model_name, dir_name): | |
with requests.get(f"{link}{model_name}") as r: | |
r.raise_for_status() | |
os.makedirs(os.path.dirname(dir_name / model_name), exist_ok=True) | |
with open(dir_name / model_name, "wb") as f: | |
for chunk in r.iter_content(chunk_size=8192): | |
f.write(chunk) | |
if __name__ == "__main__": | |
print("Downloading hubert_base.pt...") | |
dl_model(RVC_DOWNLOAD_LINK, "hubert_base.pt", BASE_DIR / "assets/rvc/hubert") | |
print("Downloading rmvpe.pt...") | |
dl_model(RVC_DOWNLOAD_LINK, "rmvpe.pt", BASE_DIR / "assets/rvc/rmvpe") | |
print("All models downloaded!") | |