Download trace/turns/t009/code.py from Perfect7613/weightpatch-run-math-gsm8k: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/Perfect7613/weightpatch-run-math-gsm8k/resolve/main/trace/turns/t009/code.py
- Command line
-
hf download hf://datasets/Perfect7613/weightpatch-run-math-gsm8k/trace/turns/t009/code.py
-
curl -L -o code.py https://huggingface.co/datasets/Perfect7613/weightpatch-run-math-gsm8k/resolve/main/trace/turns/t009/code.py
1.04 kB
| late_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]], | |
| layers=[33], position="mean", n=25, top=64) | |
| print("L33 contrast top 12:", late_contrast[:12]) | |
| print("L33 token writers in contrast:", [r for r in late_contrast if (r["layer"],r["neuron"]) in writer_units]) | |
| agreed_units = sorted(u for u in (fmt_shared | transition_agreement)-safe_units if 19<=u[0]<35) | |
| agreed_traces = {} | |
| for i in [1,126,2]: | |
| tr = tools.localize.neuron_trace(prompts[i], units=agreed_units, answer=answers[i]) | |
| agreed_traces[i] = tr | |
| start = tr["answer_starts_at"] | |
| print("AGREED TRACE",i) | |
| for key, vals in tr["acts"].items(): | |
| a = np.asarray(vals)[start:] | |
| inds = np.argsort(np.abs(a))[-3:][::-1] | |
| print(key, round(float(a.mean()),3), round(float(np.abs(a).mean()),3), | |
| [(str(tr["tokens"][start+int(j)]),round(float(a[j]),2)) for j in inds]) |