Download scripts/verifier_shadow_report.py from khiemdztv/civic-backup: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/khiemdztv/civic-backup/resolve/main/scripts/verifier_shadow_report.py
- Command line
-
hf download hf://khiemdztv/civic-backup/scripts/verifier_shadow_report.py
-
curl -L -o verifier_shadow_report.py https://huggingface.co/khiemdztv/civic-backup/resolve/main/scripts/verifier_shadow_report.py
1.35 kB
| #!/usr/bin/env python3 | |
| """Tổng hợp nhật ký LegalVerifier chạy song song: mức đồng thuận với lượt kiểm chứng của Gemini. | |
| python3 scripts/verifier_shadow_report.py [reports/logs/verifier_shadow.jsonl] | |
| """ | |
| import collections | |
| import json | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def main() -> int: | |
| path = Path(sys.argv[1]) if len(sys.argv) > 1 else ROOT / "reports/logs/verifier_shadow.jsonl" | |
| rows = [json.loads(l) for l in open(path, encoding="utf-8") if l.strip()] if path.exists() else [] | |
| if not rows: | |
| print(f"Chưa có bản ghi trong {path}") | |
| return 0 | |
| n = len(rows) | |
| agree = sum(1 for r in rows if r.get("agree")) | |
| table = collections.Counter((r.get("gemini_supported"), r.get("nli_label")) for r in rows) | |
| print(f"{n} ý đã chấm ({rows[0]['ts']} → {rows[-1]['ts']})") | |
| print(f"Đồng thuận với Gemini: {agree}/{n} = {agree / n:.1%}\n") | |
| labels = ["ENTAILED", "CONTRADICTED", "INSUFFICIENT"] | |
| head = "Gemini / NLI" | |
| print(f"{head:<18}" + "".join(f"{l:>14}" for l in labels)) | |
| for g, name in ((True, "được chứng minh"), (False, "không chứng minh")): | |
| print(f"{name:<18}" + "".join(f"{table[(g, l)]:>14}" for l in labels)) | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |