| #!/usr/bin/env bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -euo pipefail |
|
|
| ROOT="${1:?usage: restore.sh /your/data/root}" |
| REPO_ID="CedLJH/rna-sbdd-v2" |
| DOWNLOAD="$ROOT/rna-sbdd-v2-download" |
|
|
| command -v hf >/dev/null || { |
| echo "hf CLI not found: pip install -U huggingface_hub" >&2; exit 1; } |
| command -v unzstd >/dev/null || { |
| echo "unzstd not found: install zstd" >&2; exit 1; } |
|
|
| mkdir -p "$ROOT" |
|
|
| echo "==> downloading $REPO_ID" |
| hf download "$REPO_ID" --repo-type=dataset --local-dir "$DOWNLOAD" |
|
|
| echo "==> verifying the dataset archive" |
| ( cd "$DOWNLOAD/dataset" && sha256sum -c SHA256SUMS ) |
|
|
| echo "==> extracting the dataset release" |
| tar --use-compress-program=unzstd \ |
| -xf "$DOWNLOAD"/dataset/*.tar.zst -C "$ROOT" |
|
|
| echo "==> placing benchmark artifacts" |
| rm -rf "$ROOT/benchmark_artifacts" |
| cp -r "$DOWNLOAD/benchmark_artifacts" "$ROOT/benchmark_artifacts" |
|
|
| echo "==> placing checkpoints" |
| rm -rf "$ROOT/checkpoints" |
| cp -r "$DOWNLOAD/checkpoints" "$ROOT/checkpoints" |
|
|
| echo "==> verifying checkpoint digests" |
| python3 - "$ROOT/checkpoints" <<'PY' |
| import hashlib, json, sys |
| from pathlib import Path |
|
|
| root = Path(sys.argv[1]) |
| manifest = json.loads((root / "MANIFEST.json").read_text()) |
| entries = manifest["bound"] + manifest["merged_wave_terminal"] |
|
|
| bad = missing = 0 |
| for entry in entries: |
| path = root.parent / entry["repo_path"] |
| if not path.is_file(): |
| print(f" MISSING {entry['repo_path']}") |
| missing += 1 |
| continue |
| digest = hashlib.sha256() |
| with open(path, "rb") as handle: |
| for block in iter(lambda: handle.read(1 << 20), b""): |
| digest.update(block) |
| if digest.hexdigest() != entry["sha256"]: |
| print(f" CORRUPT {entry['repo_path']}") |
| bad += 1 |
| |
| total = len(entries) |
| print(f" {total - bad - missing}/{total} checkpoints verified") |
| if bad or missing: |
| sys.exit(1) |
| PY |
| |
| cat <<EOF |
| |
| Done. Dataset, artifacts, and weights are in place under $ROOT. |
| |
| Next, bind the repository to these paths: |
| |
| python scripts/remap_paths.py --repo /path/to/RNASBDD \\ |
| --data-root $ROOT \\ |
| --env-prefix /your/conda/envs/rnasbdd \\ |
| --crossdocked-root /your/sbdd_data |
| |
| That is a dry run until you add --apply. Afterwards, run the test suite. |
| EOF |
| |