File size: 1,162 Bytes
a863f79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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")