import json import os import sys import traceback from pathlib import Path from huggingface_hub import snapshot_download REPOS = [ ("HuggingFaceM4/Idefics3-8B-Llama3", "Idefics3-8B-Llama3"), ("OpenGVLab/InternVL3-9B-Instruct", "InternVL3-9B-Instruct"), ("allenai/Molmo-7B-D-0924", "Molmo-7B-D-0924"), ] root = Path("/repository/models") log = Path("n_full_v1/assets/model_download.log") if not log.parent.exists(): log = Path("/mnt/f70f6709-366e-49a0-861f-497645d98975/lyz/GraphEvolve/n_full_v1/assets/model_download.log") with log.open("a", encoding="utf-8") as fh: for repo, name in REPOS: target = root / name fh.write(f"START {repo} -> {target}\n") fh.flush() try: path = snapshot_download( repo_id=repo, local_dir=str(target), local_dir_use_symlinks=False, max_workers=8, resume_download=True, ) fh.write(f"DONE {repo} {path}\n") except Exception: fh.write(f"FAIL {repo}\n{traceback.format_exc()}\n") fh.flush() fh.write("ALL_DONE\n") print("ALL_DONE")