MikuAI/rvc/download_models.py
2024-03-31 19:52:44 +00:00

28 lines
881 B
Python

from pathlib import Path
import requests
MDX_DOWNLOAD_LINK = 'https://github.com/TRvlvr/model_repo/releases/download/all_public_uvr_models/'
RVC_DOWNLOAD_LINK = 'https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/'
BASE_DIR = Path(__file__).resolve().parent
mdxnet_models_dir = BASE_DIR / 'mdxnet_models'
rvc_models_dir = BASE_DIR / 'rvc_models'
def dl_model(link, model_name, dir_name):
with requests.get(f'{link}{model_name}') as r:
r.raise_for_status()
with open(dir_name / model_name, 'wb') as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
if __name__ == '__main__':
rvc_model_names = ['hubert_base.pt', 'rmvpe.pt']
for model in rvc_model_names:
print(f'Downloading {model}...')
dl_model(RVC_DOWNLOAD_LINK, model, rvc_models_dir)
print('All models downloaded!')