download_uvr5.py 701 B

123456789101112131415161718
  1. import os
  2. from huggingface_hub import hf_hub_download
  3. def download_uvr5(model_name):
  4. local_dir = os.environ.get("weight_uvr5_root", "data/models/rvc/uvr5_weights")
  5. if not os.path.exists(os.path.join(local_dir, model_name)):
  6. print("Downloading uvr5")
  7. file = hf_hub_download(
  8. repo_id="lj1995/VoiceConversionWebUI",
  9. filename="uvr5_weights/" + model_name,
  10. local_dir=local_dir.replace("uvr5_weights", ""),
  11. local_dir_use_symlinks=False,
  12. )
  13. print(f"uvr5 downloaded to {os.environ.get('weight_uvr5_root')}")
  14. return file
  15. else:
  16. print(f"uvr5 already downloaded to {os.environ.get('weight_uvr5_root')}")