Datasets:
Download code/fetch_models_hf.py from spatial-evidence-bench/SpatialEvidenceBench: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/datasets/spatial-evidence-bench/SpatialEvidenceBench/resolve/2b2e98a86663b2fd7de0817c2c5db0d4f2e7bc83/code/fetch_models_hf.py
- Command line
-
hf download hf://datasets/spatial-evidence-bench/SpatialEvidenceBench@2b2e98a86663b2fd7de0817c2c5db0d4f2e7bc83/code/fetch_models_hf.py
-
curl -L -o fetch_models_hf.py https://huggingface.co/datasets/spatial-evidence-bench/SpatialEvidenceBench/resolve/2b2e98a86663b2fd7de0817c2c5db0d4f2e7bc83/code/fetch_models_hf.py
1 kB
| import os | |
| import sys | |
| import time | |
| os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com") | |
| os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1" | |
| from huggingface_hub import snapshot_download | |
| REPOS = [ | |
| ("HuggingFaceM4/Idefics3-8B-Llama3", "Idefics3-8B-Llama3"), | |
| ("OpenGVLab/InternVL3-9B-Instruct", "InternVL3-9B-Instruct"), | |
| ] | |
| def download(repo, dest): | |
| for attempt in range(1, 21): | |
| try: | |
| path = snapshot_download( | |
| repo_id=repo, | |
| local_dir=dest, | |
| max_workers=4, | |
| allow_patterns=["*.json", "*.safetensors", "*.txt", "*.model", "*.py", "*.jinja"], | |
| ) | |
| print(f"MODEL_DONE {repo} -> {path}", flush=True) | |
| return | |
| except Exception as exc: | |
| print(f"RETRY {repo} attempt={attempt} {type(exc).__name__}: {str(exc)[:200]}", flush=True) | |
| time.sleep(20) | |
| for repo, name in REPOS: | |
| download(repo, f"/repository/models/{name}") | |
| print("ALL_DONE", flush=True) | |