File size: 1,184 Bytes
d545a7e | 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 | #!/usr/bin/env bash
# Restore the MergeBench artefacts from the Hub copy after a working-tree loss.
#
# We have published additively all night, so the dataset repo is the authoritative backup. This
# downloads it to a staging directory and reports what is there; it does NOT overwrite anything by
# itself -- the caller decides what to put back, because a partially-restored tree that then gets
# republished is how good artefacts become degraded ones.
#
# bash scripts/restore_from_hub.sh [staging_dir]
set -u
cd "$(dirname "$0")/.."
PY=${PYTHON:-/root/venvs/mergeability/bin/python}
[ -f /root/.ms_hf_env ] && set -a && . /root/.ms_hf_env && set +a
DEST=${1:-/root/mergebench_restore}
PYTHONPATH=src exec "$PY" - "$DEST" <<'PY'
import sys, os
from huggingface_hub import snapshot_download
dest = sys.argv[1]
p = snapshot_download("Mergeability-2/mergebench-property-sweep", repo_type="dataset",
local_dir=dest)
print("restored snapshot ->", p)
for root, _d, files in os.walk(p):
if ".cache" in root:
continue
for f in sorted(files):
fp = os.path.join(root, f)
print(f" {os.path.getsize(fp):9d} {os.path.relpath(fp, p)}")
PY
|