forked from karpathy/nanoGPT
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements a mostly drop-in replacement for LayerNorm, called FakeLayerNorm, that eventually just uses a fixed std value instead of the actual standard deviation.
- Loading branch information
1 parent
9755682
commit 1f6c25e
Showing
4 changed files
with
305 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import time | ||
|
||
eval_interval = 50 | ||
eval_iters = 50 | ||
log_interval = 1 | ||
wandb_log = True | ||
wandb_project = 'stefan_remove_layer_norm' | ||
name = 'gpt2-noLN' | ||
wandb_run_name = name + '-' + str(time.time()) | ||
out_dir = f'out/{name}/' | ||
dropout = 0 | ||
dataset = 'openwebtext' | ||
init_from = 'gpt2' | ||
remove_layer_norm = True | ||
|
||
# only save checkpoints if the validation loss improves? | ||
always_save_checkpoint = True | ||
|
||
block_size = 1024 | ||
# OAI paper uses batch size 0.5M tokens (~2**19): | ||
desired_batch_size = 2**19 / block_size | ||
# What fits comfortably on my A100 without random crashes: | ||
batch_size = 48 | ||
# Use gradient accumulation steps to match the effective batch size. | ||
gradient_accumulation_steps = int(desired_batch_size // batch_size) | ||
|
||
# Compiling didn't work for me. | ||
compile = False | ||
|
||
# We're not actually going all the way to 3000 iters. | ||
learning_rate = 6e-4 | ||
warmup_iters = 100 | ||
decay_lr = True | ||
lr_decay_iters = 2_000 | ||
max_iters = 3_000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
std_dict = { | ||
'blocks.0.hook_resid_pre': 0.16597528755664825, | ||
'blocks.0.hook_resid_mid': 1.2066363096237183, | ||
'blocks.0.hook_resid_post': 1.8281980752944946, | ||
'blocks.1.hook_resid_pre': 1.8281980752944946, | ||
'blocks.1.hook_resid_mid': 1.9805375337600708, | ||
'blocks.1.hook_resid_post': 2.0672824382781982, | ||
'blocks.2.hook_resid_pre': 2.0672824382781982, | ||
'blocks.2.hook_resid_mid': 2.1439383029937744, | ||
'blocks.2.hook_resid_post': 2.21846604347229, | ||
'blocks.3.hook_resid_pre': 2.21846604347229, | ||
'blocks.3.hook_resid_mid': 2.3077552318573, | ||
'blocks.3.hook_resid_post': 2.411747694015503, | ||
'blocks.4.hook_resid_pre': 2.411747694015503, | ||
'blocks.4.hook_resid_mid': 2.4973394870758057, | ||
'blocks.4.hook_resid_post': 2.590416193008423, | ||
'blocks.5.hook_resid_pre': 2.590416193008423, | ||
'blocks.5.hook_resid_mid': 2.7218010425567627, | ||
'blocks.5.hook_resid_post': 2.8397440910339355, | ||
'blocks.6.hook_resid_pre': 2.8397440910339355, | ||
'blocks.6.hook_resid_mid': 3.0089480876922607, | ||
'blocks.6.hook_resid_post': 3.1704721450805664, | ||
'blocks.7.hook_resid_pre': 3.1704721450805664, | ||
'blocks.7.hook_resid_mid': 3.444382667541504, | ||
'blocks.7.hook_resid_post': 3.697692632675171, | ||
'blocks.8.hook_resid_pre': 3.697692632675171, | ||
'blocks.8.hook_resid_mid': 4.003428936004639, | ||
'blocks.8.hook_resid_post': 4.340140342712402, | ||
'blocks.9.hook_resid_pre': 4.340140342712402, | ||
'blocks.9.hook_resid_mid': 4.885100841522217, | ||
'blocks.9.hook_resid_post': 5.460267066955566, | ||
'blocks.10.hook_resid_pre': 5.460267066955566, | ||
'blocks.10.hook_resid_mid': 6.5338945388793945, | ||
'blocks.10.hook_resid_post': 7.905750751495361, | ||
'blocks.11.hook_resid_pre': 7.905750751495361, | ||
'blocks.11.hook_resid_mid': 14.712532043457031, | ||
'blocks.11.hook_resid_post': 16.716890335083008, | ||
} | ||
std_bos_dict = { | ||
'blocks.0.hook_resid_pre': 0.37046778202056885, | ||
'blocks.0.hook_resid_mid': 1.0648562908172607, | ||
'blocks.0.hook_resid_post': 5.1225905418396, | ||
'blocks.1.hook_resid_pre': 5.1225905418396, | ||
'blocks.1.hook_resid_mid': 6.165660381317139, | ||
'blocks.1.hook_resid_post': 22.7987060546875, | ||
'blocks.2.hook_resid_pre': 22.7987060546875, | ||
'blocks.2.hook_resid_mid': 22.831886291503906, | ||
'blocks.2.hook_resid_post': 92.71648406982422, | ||
'blocks.3.hook_resid_pre': 92.71648406982422, | ||
'blocks.3.hook_resid_mid': 92.6193618774414, | ||
'blocks.3.hook_resid_post': 99.36549377441406, | ||
'blocks.4.hook_resid_pre': 99.36549377441406, | ||
'blocks.4.hook_resid_mid': 99.33074188232422, | ||
'blocks.4.hook_resid_post': 104.73529815673828, | ||
'blocks.5.hook_resid_pre': 104.73529815673828, | ||
'blocks.5.hook_resid_mid': 104.69013214111328, | ||
'blocks.5.hook_resid_post': 108.10015869140625, | ||
'blocks.6.hook_resid_pre': 108.10015869140625, | ||
'blocks.6.hook_resid_mid': 108.12938690185547, | ||
'blocks.6.hook_resid_post': 110.11644744873047, | ||
'blocks.7.hook_resid_pre': 110.11644744873047, | ||
'blocks.7.hook_resid_mid': 110.13978576660156, | ||
'blocks.7.hook_resid_post': 111.3284912109375, | ||
'blocks.8.hook_resid_pre': 111.3284912109375, | ||
'blocks.8.hook_resid_mid': 111.39237976074219, | ||
'blocks.8.hook_resid_post': 112.07467651367188, | ||
'blocks.9.hook_resid_pre': 112.07467651367188, | ||
'blocks.9.hook_resid_mid': 112.13053131103516, | ||
'blocks.9.hook_resid_post': 112.44728088378906, | ||
'blocks.10.hook_resid_pre': 112.44728088378906, | ||
'blocks.10.hook_resid_mid': 112.48235321044922, | ||
'blocks.10.hook_resid_post': 112.49034881591797, | ||
'blocks.11.hook_resid_pre': 112.49034881591797, | ||
'blocks.11.hook_resid_mid': 17.505901336669922, | ||
'blocks.11.hook_resid_post': 13.783772468566895, | ||
} |
Oops, something went wrong.