download_models.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import os
  2. from huggingface_hub import hf_hub_download
  3. # Download
  4. def check_and_download_files(repo_id, file_list, local_dir):
  5. os.makedirs(local_dir, exist_ok=True)
  6. for file in file_list:
  7. file_path = os.path.join(local_dir, file)
  8. if not os.path.exists(file_path):
  9. print(f"{file} 不存在,从 Hugging Face 仓库下载...")
  10. hf_hub_download(
  11. repo_id=repo_id,
  12. filename=file,
  13. resume_download=True,
  14. local_dir=local_dir,
  15. local_dir_use_symlinks=False,
  16. )
  17. else:
  18. print(f"{file} 已存在,跳过下载。")
  19. # 1st
  20. repo_id_1 = "fishaudio/openaudio-s1-mini"
  21. local_dir_1 = "./checkpoints/openaudio-s1-mini"
  22. files_1 = [
  23. ".gitattributes",
  24. "model.pth",
  25. "README.md",
  26. "special_tokens.json",
  27. "tokenizer.tiktoken",
  28. "config.json",
  29. "codec.pth",
  30. ]
  31. # 3rd
  32. repo_id_3 = "fishaudio/fish-speech-1"
  33. local_dir_3 = "./"
  34. files_3 = [
  35. "ffmpeg.exe",
  36. "ffprobe.exe",
  37. ]
  38. # 4th
  39. repo_id_4 = "SpicyqSama007/fish-speech-packed"
  40. local_dir_4 = "./"
  41. files_4 = [
  42. "asr-label-win-x64.exe",
  43. ]
  44. check_and_download_files(repo_id_1, files_1, local_dir_1)
  45. check_and_download_files(repo_id_3, files_3, local_dir_3)
  46. check_and_download_files(repo_id_4, files_4, local_dir_4)