Download trace/turns/t005/code.py from Perfect7613/weightpatch-run-math-gsm8k: direct link, hf CLI and curl.
- Browser
- Download file 983 Bytes
-
https://huggingface.co/datasets/Perfect7613/weightpatch-run-math-gsm8k/resolve/main/trace/turns/t005/code.py
- Command line
-
hf download hf://datasets/Perfect7613/weightpatch-run-math-gsm8k/trace/turns/t005/code.py
-
curl -L -o code.py https://huggingface.co/datasets/Perfect7613/weightpatch-run-math-gsm8k/resolve/main/trace/turns/t005/code.py
983 Bytes
| def unit_pairs(result): | |
| return {(int(l), int(j)) for l, js in result["units"].items() for j in js} | |
| fmt_shared = unit_pairs(fmt_act) & unit_pairs(fmt_weight) | |
| safe_units = unit_pairs(safe_act) | |
| writer_units = {(r["layer"],r["neuron"]) for r in writers["promote"]} | |
| print("Kit agreement excluding safety and final layer:", sorted(u for u in fmt_shared-safe_units if u[0]<35)) | |
| print("Token writers in activation kit:", sorted(writer_units & unit_pairs(fmt_act))) | |
| print("Token writers in weight kit:", sorted(writer_units & unit_pairs(fmt_weight))) | |
| contrast = tools.localize.neuron_contrast( | |
| a=[prompts[i] for i in verbose_ids], b=[prompts[i] for i in concise_ids[:25]], | |
| a_answers=[answers[i] for i in verbose_ids], b_answers=[answers[i] for i in concise_ids[:25]], | |
| position="mean", n=25, top=40) | |
| print("ANSWER CONTRAST:", contrast) | |
| print("UNPRINTED FAILURES:") | |
| for r in wrong[9:21]: | |
| print(r["i"], "target",r["target"],"final",r["final"], "tail", answers[r["i"]][-200:]) |