Download scripts/04_print_decision_summary.py from koreallmdev/dgx-harness-engineering: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/koreallmdev/dgx-harness-engineering/resolve/main/scripts/04_print_decision_summary.py
- Command line
-
hf download hf://koreallmdev/dgx-harness-engineering/scripts/04_print_decision_summary.py
-
curl -L -o 04_print_decision_summary.py https://huggingface.co/koreallmdev/dgx-harness-engineering/resolve/main/scripts/04_print_decision_summary.py
2.47 kB
| import argparse | |
| import json | |
| from pathlib import Path | |
| def latest(pattern): | |
| files = sorted(Path(".").glob(pattern), key=lambda p: p.stat().st_mtime, reverse=True) | |
| return files[0] if files else None | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--latest", action="store_true") | |
| args = ap.parse_args() | |
| failed_json = latest("reports/failed_items_*.json") | |
| repair_jsonl = latest("data/repair_dataset_from_failed_items_*.jsonl") | |
| bench_json = latest("reports/bench_14b_champion*.json") | |
| print("==== DECISION SUMMARY ====") | |
| if bench_json: | |
| obj = json.loads(bench_json.read_text(encoding="utf-8")) | |
| print("LATEST_BENCH:", bench_json) | |
| print("SUMMARY:", json.dumps(obj.get("summary", {}), ensure_ascii=False)) | |
| else: | |
| print("LATEST_BENCH: not found") | |
| print() | |
| if failed_json: | |
| obj = json.loads(failed_json.read_text(encoding="utf-8")) | |
| n = obj.get("num_failed_or_issued", 0) | |
| print("FAILED_JSON:", failed_json) | |
| print("FAILED_COUNT:", n) | |
| print("CATEGORY_COUNTS:", json.dumps(obj.get("category_counts", {}), ensure_ascii=False)) | |
| print("ISSUE_COUNTS:", json.dumps(obj.get("issue_counts", {}), ensure_ascii=False)) | |
| print() | |
| issue_counts = obj.get("issue_counts", {}) | |
| if n == 0: | |
| print("RECOMMENDATION: ์คํจ ํญ๋ชฉ์ด ์์ผ๋ฏ๋ก ์ฌํ์ตํ์ง ๋ง๊ณ ํ์ฌ ๋ชจ๋ธ์ ์ ์งํ์ ๋ ๋ฉ๋๋ค.") | |
| elif any("possible_chinese_leakage" in k for k in issue_counts): | |
| print("RECOMMENDATION: ์ค๊ตญ์ด leakage๊ฐ ์์ผ๋ฏ๋ก safety repair๋ฅผ ์ฐ์ ํด์ผ ํฉ๋๋ค.") | |
| elif set(obj.get("category_counts", {}).keys()).issubset({"systemd", "jsonl", "cuda"}): | |
| print("RECOMMENDATION: ์ ์ฒด ์ฌํ์ต๋ณด๋ค systemd/jsonl/cuda low-item repair๋ง ๊ณ ๋ คํ์๋ฉด ๋ฉ๋๋ค.") | |
| else: | |
| print("RECOMMENDATION: ์คํจ ๋ฒ์๊ฐ ๋์ต๋๋ค. ์คํจ ํญ๋ชฉ ๋ด์ฉ์ ๋จผ์ ๊ฒํ ํ ๋ค repair ๋ฒ์๋ฅผ ์ ํ์๋ ๊ฒ ์ข์ต๋๋ค.") | |
| else: | |
| print("FAILED_JSON: not found") | |
| print("RECOMMENDATION: ๋จผ์ 02_extract_failed_items.py๋ฅผ ์คํํด ์ฃผ์ธ์.") | |
| print() | |
| if repair_jsonl: | |
| rows = sum(1 for _ in repair_jsonl.open("r", encoding="utf-8")) | |
| print("REPAIR_DATASET:", repair_jsonl) | |
| print("REPAIR_ROWS:", rows) | |
| else: | |
| print("REPAIR_DATASET: not created yet") | |
| if __name__ == "__main__": | |
| main() | |