Datasets:
Download code/release_status.py from UnpluggedAI/posa-bench: direct link, hf CLI and curl.
- Browser
- Download file 4.86 kB
-
https://huggingface.co/datasets/UnpluggedAI/posa-bench/resolve/main/code/release_status.py
- Command line
-
hf download hf://datasets/UnpluggedAI/posa-bench/code/release_status.py
-
curl -L -o release_status.py https://huggingface.co/datasets/UnpluggedAI/posa-bench/resolve/main/code/release_status.py
4.86 kB
| #!/usr/bin/env python3 | |
| """Report whether the current POSA Bench bundle is preview- or rank-ready.""" | |
| from __future__ import annotations | |
| import argparse | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| BENCHMARK = Path(__file__).resolve().parents[1] | |
| REVIEWED = BENCHMARK / "review" / "results" | |
| PUBLIC_MANIFEST = BENCHMARK / "huggingface" / "dataset" / "preview-v0.1.0-manifest.json" | |
| FROZEN_RELEASE = BENCHMARK / "releases" / "preview-v0.1.0" | |
| EXPECTED_MODELS = 4 | |
| REQUIRED_SEEDS = {17, 29, 41} | |
| def digest(path: Path) -> str: | |
| value = hashlib.sha256() | |
| with path.open("rb") as handle: | |
| for block in iter(lambda: handle.read(1024 * 1024), b""): | |
| value.update(block) | |
| return value.hexdigest() | |
| def verify_manifest(manifest_path: Path, root: Path, source_field: str = "path") -> tuple[bool, str]: | |
| if not manifest_path.is_file(): | |
| return False, f"missing {manifest_path.relative_to(BENCHMARK)}" | |
| manifest = json.loads(manifest_path.read_text(encoding="utf-8")) | |
| errors = [] | |
| for entry in manifest.get("files", []): | |
| source = root / entry[source_field] | |
| if not source.is_file(): | |
| errors.append(f"missing {entry[source_field]}") | |
| elif source.stat().st_size != entry["bytes"] or digest(source) != entry["sha256"]: | |
| errors.append(f"hash mismatch {entry[source_field]}") | |
| return not errors, "; ".join(errors) if errors else f"{len(manifest.get('files', []))} hashes verified" | |
| def check() -> tuple[list[tuple[str, bool, str]], list[tuple[str, bool, str]]]: | |
| reviewed_paths = sorted(REVIEWED.glob("*.reviewed.json")) | |
| reviewed = [json.loads(path.read_text(encoding="utf-8")) for path in reviewed_paths] | |
| frozen_ok, frozen_note = verify_manifest(FROZEN_RELEASE / "manifest.json", FROZEN_RELEASE / "snapshot") | |
| public_ok, public_note = verify_manifest(PUBLIC_MANIFEST, BENCHMARK, "source") | |
| tracks = {item.get("track") for item in reviewed} | |
| statuses = {item.get("eligibility", {}).get("status") for item in reviewed} | |
| required_quality = { | |
| "semantic_claim_recall", "critical_fact_coverage_global", "safety_rate", "strict_pass_rate" | |
| } | |
| preview = [ | |
| ("Frozen baseline", frozen_ok, frozen_note), | |
| ("Curated public manifest", public_ok, public_note), | |
| ("Four reviewed candidates", len(reviewed) == EXPECTED_MODELS, f"found {len(reviewed)}"), | |
| ( | |
| "Fixed-context isolation", | |
| tracks == {"fixed-context-common-runtime"}, | |
| ", ".join(str(value) for value in sorted(tracks)), | |
| ), | |
| ("Explicitly unranked", statuses == {"unranked-preview"}, ", ".join(str(value) for value in statuses)), | |
| ( | |
| "Reviewed metric completeness", | |
| all(required_quality <= set(item.get("quality", {})) for item in reviewed), | |
| "four publication metrics required", | |
| ), | |
| ] | |
| seeds_by_run = { | |
| item.get("run_id"): set(item.get("protocol", {}).get("seeds", [])) for item in reviewed | |
| } | |
| repetitions_ok = bool(reviewed) and all( | |
| int(item.get("protocol", {}).get("repetitions", 0)) >= 3 | |
| and seeds_by_run[item.get("run_id")] >= REQUIRED_SEEDS | |
| for item in reviewed | |
| ) | |
| human_review_ok = bool(reviewed) and all(item.get("review", {}).get("official") is True for item in reviewed) | |
| thermal_ok = bool(reviewed) and all( | |
| item.get("protocol", {}).get("thermal_reset_verified") is True for item in reviewed | |
| ) | |
| continuous_pss_ok = bool(reviewed) and all( | |
| item.get("protocol", {}).get("continuous_pss_sampling") is True for item in reviewed | |
| ) | |
| official = [ | |
| ( | |
| "Three seeds per model", | |
| repetitions_ok, | |
| "; ".join(f"{run}: {sorted(seeds)}" for run, seeds in seeds_by_run.items()), | |
| ), | |
| ("Two blinded humans plus adjudication", human_review_ok, "current artifacts are single-AI review"), | |
| ("Verified thermal resets", thermal_ok, "not recorded in current protocol"), | |
| ("Continuous peak-PSS sampling", continuous_pss_ok, "current values are post-run observations"), | |
| ] | |
| return preview, official | |
| def main() -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--target", choices=("preview", "official"), default="preview") | |
| args = parser.parse_args() | |
| preview, official = check() | |
| sections = [("Preview publication", preview)] | |
| if args.target == "official": | |
| sections.append(("Official ranking", official)) | |
| for title, gates in sections: | |
| print(title) | |
| for name, passed, note in gates: | |
| print(f" {'PASS' if passed else 'BLOCKED':7} {name}: {note}") | |
| selected = preview if args.target == "preview" else preview + official | |
| return 0 if all(passed for _, passed, _ in selected) else 1 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |