Spaces:
Sleeping
Sleeping
File size: 1,365 Bytes
28c720a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import os
from huggingface_hub import hf_hub_download
# Download
def check_and_download_files(repo_id, file_list, local_dir):
os.makedirs(local_dir, exist_ok=True)
for file in file_list:
file_path = os.path.join(local_dir, file)
if not os.path.exists(file_path):
print(f"{file} 不存在,从 Hugging Face 仓库下载...")
hf_hub_download(
repo_id=repo_id,
filename=file,
resume_download=True,
local_dir=local_dir,
local_dir_use_symlinks=False,
)
else:
print(f"{file} 已存在,跳过下载。")
# 1st
repo_id_1 = "fishaudio/fish-speech-1.4"
local_dir_1 = "./checkpoints/fish-speech-1.4"
files_1 = [
"model.pth",
"README.md",
"special_tokens_map.json",
"tokenizer_config.json",
"tokenizer.json",
"config.json",
"firefly-gan-vq-fsq-8x1024-21hz-generator.pth",
]
# 3rd
repo_id_3 = "fishaudio/fish-speech-1"
local_dir_3 = "./"
files_3 = [
"ffmpeg.exe",
"ffprobe.exe",
]
# 4th
repo_id_4 = "SpicyqSama007/fish-speech-packed"
local_dir_4 = "./"
files_4 = [
"asr-label-win-x64.exe",
]
check_and_download_files(repo_id_1, files_1, local_dir_1)
check_and_download_files(repo_id_3, files_3, local_dir_3)
check_and_download_files(repo_id_4, files_4, local_dir_4)
|