Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions demos/ARENA_Content.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@
" \"gpt2\",\n",
" device=device,\n",
")\n",
"reference_gpt2.enable_compatibility_mode(disable_warnings=True)"
"reference_gpt2.enable_compatibility_mode(disable_warnings=True)",
"\n",
"reference_gpt2.set_use_split_qkv_input(True)\n",
"reference_gpt2.set_use_attn_result(True)"
]
},
{
Expand All @@ -98,7 +101,7 @@
"source": [
"\n",
"# [1.1] Transformer From Scratch\n",
"# 1️⃣ UNDERSTANDING INPUTS & OUTPUTS OF A TRANSFORMER\n",
"# 1\ufe0f\u20e3 UNDERSTANDING INPUTS & OUTPUTS OF A TRANSFORMER\n",
"\n",
"sorted_vocab = sorted(list(reference_gpt2.tokenizer.vocab.items()), key=lambda n: n[1])\n",
"first_vocab = sorted_vocab[0]\n",
Expand Down Expand Up @@ -287,7 +290,7 @@
}
],
"source": [
"# 2️⃣ CLEAN TRANSFORMER IMPLEMENTATION\n",
"# 2\ufe0f\u20e3 CLEAN TRANSFORMER IMPLEMENTATION\n",
"\n",
"layer_0_hooks = [\n",
" (name, tuple(tensor.shape)) for name, tensor in cache.items() if \".0.\" in name\n",
Expand All @@ -311,32 +314,30 @@
" ('blocks.0.attn.hook_hidden_states', (1, 35, 768)),\n",
" ('blocks.0.attn.hook_in', (1, 35, 768)),\n",
" ('blocks.0.attn.hook_k', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.hook_k_input', (1, 35, 12, 768)),\n",
" ('blocks.0.attn.hook_out', (1, 35, 768)),\n",
" ('blocks.0.attn.hook_pattern', (1, 12, 35, 35)),\n",
" ('blocks.0.attn.hook_q', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.hook_result', (1, 35, 768)),\n",
" ('blocks.0.attn.hook_q_input', (1, 35, 12, 768)),\n",
" ('blocks.0.attn.hook_result', (1, 35, 12, 768)),\n",
" ('blocks.0.attn.hook_v', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.hook_v_input', (1, 35, 12, 768)),\n",
" ('blocks.0.attn.hook_z', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.k.hook_in', (1, 35, 768)),\n",
" ('blocks.0.attn.k.hook_out', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.o.hook_in', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.o.hook_out', (1, 35, 768)),\n",
" ('blocks.0.attn.q.hook_in', (1, 35, 768)),\n",
" ('blocks.0.attn.q.hook_out', (1, 35, 12, 64)),\n",
" ('blocks.0.attn.v.hook_in', (1, 35, 768)),\n",
" ('blocks.0.attn.v.hook_out', (1, 35, 12, 64)),\n",
" ('blocks.0.hook_attn_in', (1, 35, 768)),\n",
" ('blocks.0.hook_attn_out', (1, 35, 768)),\n",
" ('blocks.0.hook_in', (1, 35, 768)),\n",
" ('blocks.0.hook_k_input', (1, 35, 768)),\n",
" ('blocks.0.hook_k_input', (1, 35, 12, 768)),\n",
" ('blocks.0.hook_mlp_in', (1, 35, 768)),\n",
" ('blocks.0.hook_mlp_out', (1, 35, 768)),\n",
" ('blocks.0.hook_out', (1, 35, 768)),\n",
" ('blocks.0.hook_q_input', (1, 35, 768)),\n",
" ('blocks.0.hook_q_input', (1, 35, 12, 768)),\n",
" ('blocks.0.hook_resid_mid', (1, 35, 768)),\n",
" ('blocks.0.hook_resid_post', (1, 35, 768)),\n",
" ('blocks.0.hook_resid_pre', (1, 35, 768)),\n",
" ('blocks.0.hook_v_input', (1, 35, 768)),\n",
" ('blocks.0.hook_v_input', (1, 35, 12, 768)),\n",
" ('blocks.0.ln1.hook_in', (1, 35, 768)),\n",
" ('blocks.0.ln1.hook_normalized', (1, 35, 768)),\n",
" ('blocks.0.ln1.hook_out', (1, 35, 768)),\n",
Expand Down Expand Up @@ -373,7 +374,7 @@
"source": [
"# NBVAL_IGNORE_OUTPUT\n",
"# [1.2] Intro to mech interp\n",
"# 2️⃣ FINDING INDUCTION HEADS\n",
"# 2\ufe0f\u20e3 FINDING INDUCTION HEADS\n",
"\n",
"if not IN_GITHUB:\n",
" # Cannot run in CI\n",
Expand Down
Loading
Loading