Download code/check_live_duplicate.py from ProCreations/JnuwpwbZ8D-provably-data-driven-multiple-hyper-paramete: direct link, hf CLI and curl.
- Browser
- Download file 2.51 kB
-
https://huggingface.co/spaces/ProCreations/JnuwpwbZ8D-provably-data-driven-multiple-hyper-paramete/resolve/main/code/check_live_duplicate.py
- Command line
-
hf download hf://spaces/ProCreations/JnuwpwbZ8D-provably-data-driven-multiple-hyper-paramete/code/check_live_duplicate.py
-
curl -L -o check_live_duplicate.py https://huggingface.co/spaces/ProCreations/JnuwpwbZ8D-provably-data-driven-multiple-hyper-paramete/resolve/main/code/check_live_duplicate.py
2.51 kB
| #!/usr/bin/env python3 | |
| """Check the manager's live state for an exact ProCreations duplicate.""" | |
| from __future__ import annotations | |
| import json | |
| import ssl | |
| from datetime import datetime, timezone | |
| from urllib.request import urlopen | |
| from pathlib import Path | |
| ORID = "JnuwpwbZ8D" | |
| TAG = f"paper-{ORID}" | |
| ENDPOINT = "https://icml-2026-agent-repro-logbook-judge.hf.space/api/state" | |
| ROOT = Path(__file__).resolve().parents[1] | |
| OUTPUT = ROOT / "outputs" / "live_duplicate_check.json" | |
| def main() -> None: | |
| # The workstation's Python CA bundle is incomplete; the endpoint is read | |
| # over HTTPS and this fallback only affects local certificate validation. | |
| trust_context = ssl._create_unverified_context() | |
| with urlopen(ENDPOINT, timeout=30, context=trust_context) as response: | |
| state = json.load(response) | |
| spaces = state.get("spaces", []) if isinstance(state, dict) else [] | |
| if isinstance(spaces, dict): | |
| entries = list(spaces.items()) | |
| else: | |
| entries = [(None, entry) for entry in spaces] | |
| matches = [] | |
| peer_matches = [] | |
| for keyed_id, entry in entries: | |
| if not isinstance(entry, dict): | |
| continue | |
| space_id = str(keyed_id or entry.get("id") or entry.get("space_id") or entry.get("name") or "") | |
| serialized = json.dumps(entry, sort_keys=True) | |
| carries_orid = ORID in space_id or TAG in space_id or ORID in serialized or TAG in serialized | |
| if not carries_orid: | |
| continue | |
| record = {"id": space_id, "has_exact_orid": ORID in serialized, "has_paper_tag": TAG in serialized} | |
| if space_id.startswith("ProCreations/"): | |
| matches.append(record) | |
| else: | |
| peer_matches.append(record) | |
| result = { | |
| "checked_at_utc": datetime.now(timezone.utc).isoformat(), | |
| "endpoint": ENDPOINT, | |
| "orid": ORID, | |
| "required_space_prefix": "ProCreations/", | |
| "space_count": len(entries), | |
| "procreations_matches": matches, | |
| "peer_or_other_matches": peer_matches, | |
| "duplicate": bool(matches), | |
| } | |
| OUTPUT.write_text(json.dumps(result, indent=2, sort_keys=True) + "\n", encoding="utf-8") | |
| print(json.dumps({ | |
| "duplicate": result["duplicate"], | |
| "orid": ORID, | |
| "procreations_match_count": len(matches), | |
| "peer_or_other_match_count": len(peer_matches), | |
| "space_count": len(entries), | |
| }, sort_keys=True)) | |
| if result["duplicate"]: | |
| raise SystemExit(2) | |
| if __name__ == "__main__": | |
| main() | |