d995c22128
fix bug with loading GPT-2 parameters, assert gets incorrectly tripped due to .bias missing since it is now optionally present depending on flash or not
Andrej Karpathy2023-02-01 02:05:34 +00:00
038ce89438
rename iter to it, because iter is a concrete Python builtin
Andrej Karpathy2023-01-31 23:34:02 +00:00
d2705bd92a
tune cited numbers and reproductions and more explicitly point out the problems w.r.t. the OWT vs WT domain gap
Andrej Karpathy2023-01-31 21:57:07 +00:00
924a0873eb
merge, make cleaner, careful with gradient clipping when using grad scaler fp16 training
Andrej Karpathy2023-01-30 23:40:35 +00:00
ae06d0b15a
add flash attention support, resolving last few issues but for now seems to work ok
Andrej Karpathy2023-01-30 23:18:26 +00:00
0e90ee9d48
based on my experiments these biases are indeed not needed. code runs faster, identical results. keeping the option just because it deviates from the gpt-2 setup
Andrej Karpathy2023-01-30 08:07:58 +00:00
001c1e7be7
stay true to the README file and set grad accum to 5, so the default batch size is about 0.5M and is reproducing gpt2
Andrej Karpathy2023-01-27 20:51:50 +00:00
79dbe0086d
let me set bias=True until I validate it properly, but this should be ok to merge to master for now, is equivalent to previous functionality
Andrej Karpathy2023-01-27 20:45:28 +00:00
e808a67149
bunch of plumbing of bias all around. measuring bias=False to be about 6% faster
Andrej Karpathy2023-01-27 20:41:17 +00:00
cc5444e194
add the bias option to config, default it to True for now
Andrej Karpathy2023-01-27 20:29:45 +00:00
2bf07a3fbf
rewrite model class so layernorm has an optional bias= parameter
Andrej Karpathy2023-01-27 20:17:32 +00:00
2892858ce7
attempt a non-biased model, per few papers that cite this as working well
Andrej Karpathy2023-01-27 18:54:08 +00:00
f29a9ff5bf
ok i tried bringing back original init again and this time it makes a ton of difference and works much better than default. i'm not sure what was different with my earlier experiment where i saw a slight regression. may try to dissect commits later, for now merged the original mingpt init (following gpt-2 paper) as default.
Andrej Karpathy2023-01-27 17:56:18 +00:00
3cb3fc059c
grad clipping seems to slightly speed up training in the beginning but i can't see a big difference later in the training. it costs non-negligeable compute to clip. adding it for now because it is standard, and i think more necessary as the model becomes larger. practitioners may consider turning it off for minor efficiency gains
Andrej Karpathy2023-01-27 16:45:09 +00:00
a6bffeee59
Merge pull request #73 from danielgross/master
Andrej2023-01-20 12:21:33 -08:00
edb7a7eab0
use relative paths so that running the data prep scripts always create files in local folder, no matter where run from
DG2023-01-20 10:39:45 -08:00
67166079c9
Zero-grad more aggressively to save memory
Clive Chan2023-01-19 22:10:44 -08:00
6dab32c003
experimenting with badges, and discord link to start specifically. issues sometimes feel a little too heavy
Andrej Karpathy2023-01-18 03:09:42 +00:00
be571fff2c
Improve readability of huge numbers
リョウゼ2023-01-16 22:05:32 +01:00
7f74652843
add docs on multinode training to main README too
Andrej Karpathy2023-01-16 17:11:02 +00:00
46ce9971df
small tweaks to docs and variable names stylistically
Andrej Karpathy2023-01-16 16:56:05 +00:00
684800dd87
clarify that these should be run on two separate machines
Andrej Karpathy2023-01-16 06:02:46 +00:00
cf99914886
add gradient accumulation support to simulate larger batch sizes. ty @VHellendoorn for original PR
Andrej Karpathy2023-01-15 17:49:55 +00:00
89da79eee1
add note of caution for the produced warning, investigate later
Andrej Karpathy2023-01-14 20:38:22 +00:00
7d7ded25ce
a bit better settings... for a single gpu at least. these settings would fry a simple cpu though i think
Andrej Karpathy2023-01-14 03:59:53 +00:00
91d02510ce
fix bug... if topk > vocab_size, torch.topk will throw error
Andrej Karpathy2023-01-14 03:57:00 +00:00
57735f532d
correctly propagate the vocab_size from the rendered dataset into the model args
Andrej Karpathy2023-01-14 02:26:44 +00:00
43b37fd568
reverse the order, making sure that the final layer init is preserved, and becomes the token embedding instead of the other way around. otherwise the loss can be all messed up from a bad init
Andrej Karpathy2023-01-14 02:16:10 +00:00
7c8288552b
tie the weights of lm_head.weight and transformer.wte.weight, i.e. the last linear layer of decoder and the token embeddings.
Andrej Karpathy2023-01-14 01:00:55 +00:00
3e0fd42579
more scaling laws, clarification, and add simple interpolation of Approach 2
Andrej Karpathy2023-01-13 00:57:15 +00:00
8f85b83347
inference time mini-optimization low-hanging fruit ty @jxtps for raising: when we are running inference we can apply lm_head on only the very last token
Andrej Karpathy2023-01-12 06:02:50 +00:00
e21cbf887f
meant to set always_save_checkpoint to False instead, so we only write when val improves
Andrej Karpathy2023-01-12 05:47:34 +00:00
c1ac2d58f1
including transformers as a dependency of the repo as well
Andrej Karpathy2023-01-12 02:42:38 +00:00
7f51d17977
add note about windows and pytorch 2.0 and torch compile in general
Andrej Karpathy2023-01-12 02:17:52 +00:00
bb49751439
oh no nanoGPT is trending quickly explain the character-level functionality I added late last night
Andrej Karpathy2023-01-11 17:11:15 +00:00
d17350a31d
add support for character-level language models, a new character-level shakespeare dataset, a new config file that shows how to train a character-level baby GPT on it, and adjust the sample function to figure out if it should decode with characters or GPT2 bpe tokens. The current implementation is a bit hacky and basically assumes just these two possibilities. In the future we may want to support more general encoders or decoders.
Andrej Karpathy2023-01-11 05:27:19 +00:00
c2a402f7f7
guess the config from globals() and log all of it with wandb
Andrej Karpathy2023-01-11 01:00:22 +00:00
8b2e622b27
adjust the readme to reflect changes in the autocast branch
Andrej Karpathy2023-01-08 19:40:46 +00:00
b77c2e86d3
copy pasting what seems to work to bench,sample as well. ty @lantiga
Andrej Karpathy2023-01-08 19:32:13 +00:00
69d1a5f1af
update scaling laws. basically i can't reproduce any of params, flops, or scaling laws of the Chinchilla paper atm...
Andrej Karpathy2023-01-06 02:01:08 +00:00
9629093e53
minor args re-arranging and removing some spurious ones like wandb entity ty @tcapelle
Andrej Karpathy2023-01-05 01:14:02 +00:00
529c967a65
Merge pull request #19 from nat/patch-1
Andrej2023-01-04 16:46:32 -08:00
d562b3e550
shuttling the poor mans configurator aside into its own file and adding it to all of train,sample,bench. because i am leaving args in globals() so i can avoid having to prepend every single variable with an args., i have to exec the configurator and the optional configs. so we're left with something very gross by standard convention but also quite simple and functional. *ducks*
Andrej Karpathy2023-01-05 00:44:35 +00:00
2b9e168736
Strip unwanted prefix from state keys when loading model
Nat Friedman2023-01-04 16:34:00 -08:00
ab04701f9f
mention current 8GPU SOTA and shuffle sections a bit
Andrej Karpathy2023-01-04 18:59:10 +00:00
1eefbb2520
Merge pull request #16 from jorahn/patch-1
Andrej2023-01-04 09:08:50 -08:00
c72ecf5d93
add a notebook trying to reproduce chinchilla scaling laws. I can't get the numbers to be exactly right, have to look at more
Andrej Karpathy2023-01-04 00:59:34 +00:00
9f95aca93e
better hyperparams for gpt2 124M model on A100 40GB. still uncertain about max_iters especially, and a bit about weight decay, betas
Andrej Karpathy2023-01-03 17:45:49 +00:00
b45eec3e4b
flesh out the remaining TODOs in readme a bit more
Andrej Karpathy2023-01-03 07:41:28 +00:00
177d5f7dc5
disabling torch.jit.script here for massive performance boost when using torch.compile, our default. see issue #11. thanks @vgoklani for flagging
Andrej Karpathy2023-01-02 23:05:01 +00:00
2febf4463c
candidate changes to apis, have to think through more
Andrej Karpathy2023-01-01 01:29:48 +00:00
7c6ea8409e
simplify the prepare script a lot, write only using one process, seems sufficient for now. ty @LaihoE for suggestion and @proger for flagging
Andrej Karpathy2022-12-30 22:18:20 +00:00