defdownload_model(repo_id="IndexTeam/IndexTTS-2", folder="./checkpoints"): os.makedirs(folder, exist_ok=True) url = f"https://huggingface.co/api/models/{repo_id}" data = requests.get(url).json() for f in tqdm(data["siblings"], desc="Downloading"): name = f["rfilename"] dest = os.path.join(folder, repo_id.split('/')[-1], name) os.makedirs(os.path.dirname(dest), exist_ok=True) if os.path.exists(dest) and os.path.getsize(dest) > 0: continue urllib.request.urlretrieve( f"https://huggingface.co/{repo_id}/resolve/main/{name}", dest) print("✅ Model saved to", os.path.abspath(folder))