Download docking_pipeline/audit_strategy_benchmark.py from QPromaQ/Docking_project: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/datasets/QPromaQ/Docking_project/resolve/main/docking_pipeline/audit_strategy_benchmark.py
- Command line
-
hf download hf://datasets/QPromaQ/Docking_project/docking_pipeline/audit_strategy_benchmark.py
-
curl -L -o audit_strategy_benchmark.py https://huggingface.co/datasets/QPromaQ/Docking_project/resolve/main/docking_pipeline/audit_strategy_benchmark.py
1.97 kB
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from typing import Any | |
| from .provenance import require_file | |
| def audit_strategy_benchmark(run_dir: str | Path) -> dict[str, Any]: | |
| root = Path(run_dir) | |
| summary = json.loads(require_file(root / "metrics" / "strategy_comparison_summary.json", "strategy benchmark summary").read_text(encoding="utf-8")) | |
| payload = { | |
| "run_dir": str(root), | |
| "recommended_strategy_final": summary.get("recommended_strategy_final"), | |
| "recommended_reason": summary.get("recommended_reason"), | |
| "reference_mode": summary.get("reference_mode"), | |
| "reference_sample_docked_once_for_evaluation": summary.get("reference_sample_docked_once_for_evaluation"), | |
| "strategies": list((summary.get("by_strategy") or {}).keys()), | |
| } | |
| (root / "strategy_benchmark_audit.md").write_text( | |
| "\n".join( | |
| [ | |
| f"# audit-strategy-benchmark: {root.name}", | |
| "", | |
| f"- recommended_strategy_final: `{payload['recommended_strategy_final']}`", | |
| f"- recommended_reason: `{payload['recommended_reason']}`", | |
| f"- reference_sample_docked_once_for_evaluation: `{payload['reference_sample_docked_once_for_evaluation']}`", | |
| f"- strategies: `{payload['strategies']}`", | |
| ] | |
| ) | |
| + "\n", | |
| encoding="utf-8", | |
| ) | |
| return payload | |
| def build_arg_parser() -> argparse.ArgumentParser: | |
| parser = argparse.ArgumentParser(description="Audit a completed independent strategy benchmark run.") | |
| parser.add_argument("--run-dir", required=True) | |
| return parser | |
| def run_from_args(args: argparse.Namespace) -> dict[str, Any]: | |
| return audit_strategy_benchmark(args.run_dir) | |
| def main() -> int: | |
| print(json.dumps(run_from_args(build_arg_parser().parse_args()), indent=2)) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |