Spaces:
Runtime error
Runtime error
File size: 2,132 Bytes
c1f7300 55d5b92 19a018b 55d5b92 41394ac 55d5b92 |
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 57 58 59 60 61 62 63 64 |
import os
from huggingface_hub import hf_hub_download
REPO_ID = "tencent/HunyuanVideo-Avatar"
BASE_PATH = "ckpts"
LOCAL_BASE = os.path.join(os.getcwd(), "weights", "ckpts")
# List of essential files/folders to download (you can expand this if needed)
ESSENTIAL_PATHS = [
# Transformers checkpoints
"hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8.pt",
"hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states.pt",
"hunyuan-video-t2v-720p/transformers/mp_rank_00_model_states_fp8_map.pt",
# VAE
"hunyuan-video-t2v-720p/vae/config.json",
"hunyuan-video-t2v-720p/vae/pytorch_model.pt",
# llava_llama_image shard files (adjust count if needed)
"llava_llama_image/model-00001-of-00004.safetensors",
"llava_llama_image/model-00002-of-00004.safetensors",
"llava_llama_image/model-00003-of-00004.safetensors",
"llava_llama_image/model-00004-of-00004.safetensors",
"llava_llama_image/config.json",
# text_encoder_2
"text_encoder_2/config.json",
"text_encoder_2/pytorch_model.bin",
# whisper-tiny
"whisper-tiny/config.json",
"whisper-tiny/pytorch_model.bin",
"whisper-tiny/tokenizer.json",
"whisper-tiny/tokenizer_config.json",
"whisper-tiny/vocab.json",
# det_align
"det_align/config.json",
"det_align/pytorch_model.bin",
]
def download_files():
for relative_path in ESSENTIAL_PATHS:
source_path = f"{BASE_PATH}/{relative_path}"
local_dir = os.path.join(LOCAL_BASE, os.path.dirname(relative_path))
os.makedirs(local_dir, exist_ok=True)
print(f"β¬οΈ Downloading {source_path} ...")
try:
hf_hub_download(
repo_id=REPO_ID,
filename=source_path,
repo_type="model",
local_dir=local_dir,
local_dir_use_symlinks=False
)
except Exception as e:
print(f"β Failed to download {source_path}: {e}")
if __name__ == "__main__":
download_files()
print("\nβ
All selected model weights downloaded to:")
print(f"{os.path.abspath(LOCAL_BASE)}")
|