index-tts/indextts/s2mel/hf_utils.py
kemuriririn 72c09ec0b7
Indextts2 (#276)
* indextts2

* update lfs for audio files

---------

Co-authored-by: wangyining02 <wangyining02@bilibili.com>
2025-09-08 17:36:39 +08:00

12 lines
No EOL
509 B
Python

import os
from huggingface_hub import hf_hub_download
def load_custom_model_from_hf(repo_id, model_filename="pytorch_model.bin", config_filename="config.yml"):
os.makedirs("./checkpoints", exist_ok=True)
model_path = hf_hub_download(repo_id=repo_id, filename=model_filename, cache_dir="./checkpoints")
if config_filename is None:
return model_path
config_path = hf_hub_download(repo_id=repo_id, filename=config_filename, cache_dir="./checkpoints")
return model_path, config_path