setup.sh: spatial codes via single bundle (7MB vs 2200 files)
Browse files
setup.sh
CHANGED
|
@@ -339,8 +339,21 @@ token = os.environ.get("HF_TOKEN") or None
|
|
| 339 |
api = HfApi(token=token)
|
| 340 |
folders = [
|
| 341 |
"harness", "symbolic", "analysis", "corruption", "calibration",
|
| 342 |
-
"encoder", "inference", "tests",
|
| 343 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
if os.environ.get("WITH_CACHES") == "1":
|
| 345 |
folders.append("data/caches")
|
| 346 |
top_files = ["README.md", "backup.py", "setup.sh"]
|
|
|
|
| 339 |
api = HfApi(token=token)
|
| 340 |
folders = [
|
| 341 |
"harness", "symbolic", "analysis", "corruption", "calibration",
|
| 342 |
+
"encoder", "inference", "tests",
|
| 343 |
]
|
| 344 |
+
# Spatial codes ship as ONE bundled archive (bundles/spatial-codes.tar.gz, ~7MB)
|
| 345 |
+
# instead of ~2200 individual files -- orders of magnitude faster to fetch. Falls
|
| 346 |
+
# back to per-file sync if the bundle is missing from the repo.
|
| 347 |
+
import tarfile
|
| 348 |
+
try:
|
| 349 |
+
bundle = hf_hub_download(repo, "bundles/spatial-codes.tar.gz",
|
| 350 |
+
repo_type="dataset", token=token)
|
| 351 |
+
with tarfile.open(bundle) as tar:
|
| 352 |
+
tar.extractall(root)
|
| 353 |
+
print("[data/spatial codes] extracted from bundle", flush=True)
|
| 354 |
+
except Exception as exc:
|
| 355 |
+
print(f"[data/spatial codes] bundle unavailable ({exc}); per-file fallback", flush=True)
|
| 356 |
+
folders.append("data/spatial codes")
|
| 357 |
if os.environ.get("WITH_CACHES") == "1":
|
| 358 |
folders.append("data/caches")
|
| 359 |
top_files = ["README.md", "backup.py", "setup.sh"]
|