Download scripts/h2_finalize24.py from Ziruibest/jspace-unlearning: direct link, hf CLI and curl.
- Browser
- Download file 903 Bytes
-
https://huggingface.co/datasets/Ziruibest/jspace-unlearning/resolve/main/scripts/h2_finalize24.py
- Command line
-
hf download hf://datasets/Ziruibest/jspace-unlearning/scripts/h2_finalize24.py
-
curl -L -o h2_finalize24.py https://huggingface.co/datasets/Ziruibest/jspace-unlearning/resolve/main/scripts/h2_finalize24.py
903 Bytes
| """PREREG_H2 §7 finalization: per method keep FQ min/median/max candidates.""" | |
| import json | |
| EVAL = "/workspace/open-unlearning/saves/eval" | |
| cands = json.load(open("/workspace/jspace-unlearning/results/h2_pick24_candidates.json")) | |
| final = [] | |
| for m, lst in sorted(cands.items()): | |
| scored = [] | |
| for name in lst: | |
| try: | |
| fq = json.load(open(f"{EVAL}/{name}/TOFU_SUMMARY.json"))["forget_quality"] | |
| scored.append((fq, name)) | |
| except FileNotFoundError: | |
| print("missing eval:", name) | |
| scored.sort() | |
| picks = [scored[0][1], scored[len(scored) // 2][1], scored[-1][1]] | |
| final += picks | |
| print(m, [(f"{s:.1e}", n.split("_", 1)[1][:28]) for s, n in scored]) | |
| print(" ->", picks) | |
| assert len(final) == 24, len(final) | |
| json.dump(sorted(final), open("/workspace/jspace-unlearning/results/h2_pick24_final.json", "w"), indent=1) | |
| print("finalized 24") | |