文件历史

提交图

56 次代码提交

作者 SHA1 备注 提交日期
Andrej Karpathy 8b951056b5 resolve merge conflict 2024-05-24 22:04:02 +00:00
Andrej Karpathy 645869b6f7 add weight decay -c option and be more careful in our tests of correctness, our weight decay didn't match to pytorch. also modify the betas in AdamW to be consistent with those used in GPT-3 training 2024-05-23 20:45:59 +00:00
ademeure b5e75dde8e Fully deterministic encoder backward kernels for train_gpt2.cu 2024-05-21 15:57:07 +01:00
Erik Schultheis a9947a8315 added a flag and the missing sqrt;
testing now has clipping enabled
2024-05-18 22:47:15 +03:00
Andrej Karpathy 4374360015 adjust wte upper bound a bit, and print always because this part is really tricky and i don't trust anything other than manual inspection, even if we pass, allegedly 2024-05-18 18:34:24 +00:00
Erik Schultheis bf36a4b6b5 improved numerical error checking:
tighter tolarances
  relative tolerance based of bf16 epsilon
  less verbose output if all is OK
2024-05-18 13:27:35 +03:00
Erik Schultheis 57f70ea66b simplify multi-gpu logic by reducing #ifdefs 2024-05-16 14:12:14 +03:00
Andrej Karpathy 3dbb0bb89c bump the threshold for qkvw because flashattention expands the error here a tiny bit 2024-05-11 17:19:41 +00:00
Andrej Karpathy 26dbbc75c2 unbreak the tests oops 2024-05-08 20:18:33 +00:00
ademeure 876ab93c0a Add FP16 path for atomicStochasticAdd (+remove __bfloat1622float2 to work on older CUDAs) + fixes 2024-05-05 15:05:59 +01:00
ademeure bfb9c51446 refactoring & remove unused functions to reduce LOC (+wip profile.py improvements) 2024-05-04 23:40:15 +01:00
ademeure a19fcecb79 Set cuBLAS(Lt) to use the new main_stream 2024-05-03 18:35:46 +01:00
ademeure b58181079a super optimised matmul_bias + cuda streams for better parallelism + fix fused_classifier cache hint + remove remaining cooperative groups 2024-05-03 16:38:46 +01:00
Andrej Karpathy 1ed9381fd0 fix cudnnDestroy outside of ifdef 2024-05-01 17:55:36 +00:00
ademeure 1147983b8c Add missing cudnnDestroy() calls 2024-05-01 17:19:51 +01:00
ademeure d9e7a0a378 Fixed profile_gpt2.cu/test_gpt2.cu for cuDNN 2024-05-01 17:03:28 +01:00
ademeure c778dc0098 slightly increase wte threshold to make test_gpt2.cu pass (?) 2024-05-01 15:40:30 +01:00
ademeure c4ecc04dc3 Merge remote-tracking branch 'karpathy/master' into cudnn_try2 2024-05-01 15:30:00 +01:00
Andrej Karpathy 44656c3850 allow fp32 precision in the test script as well 2024-04-30 18:38:38 +00:00
Andrej Karpathy 654d6f55c5 add arg to cap the number of steps, and offset all prints to start steps at 1, which i think looks better to the eye 2024-04-30 17:46:36 +00:00
ademeure 435ac928b4 cuDNN Forward Flash Attention is working in both /dev/cuda/ and train_gpt2.cu! (backwards pass is broken for now as a conquence) 2024-04-30 17:00:09 +01:00
ademeure d23bb1fd13 Merge remote-tracking branch 'karpathy/master' into layernormbf16 2024-04-29 19:41:54 +01:00
Andrej 18b41b4df6 Merge pull request #279 from Ricardicus/prec-ci
Updating the CI to build different precisions
2024-04-28 13:47:48 -07:00
Rickard Hallerbäck b522333851 Updating the CI to build different precisions 2024-04-28 22:17:47 +02:00
Andrej Karpathy 835060e18d padded vocab change. touched a lot of code. very stressful and error prone, but i think it is done. had to bump versions on all .bin files, invalidating the previous files. re-run the python training script to re-export the new version files. let's not do too much of things like this in the future lol. actually, fun fact i had a chance to do the padded vocab really really early in the history of llm.c development, and chose not do it, thinking i'll just do it later. i should have done it. such is life, you make mistakes, you accumulate scar tissue, and you learn, and you become better, faster, stronger. this is the mindset one must have to lead a happy and fulfilling life. it's not important that you are perfect at any point in time, it's only important that you keep improving, every day. 2024-04-28 18:47:03 +00:00
Andrej Karpathy 9d70d9a1b2 profile and test only use bf16. but the train script can be run with fp32 or bf16 or fp16. fp16 will error, though 2024-04-28 16:17:22 +00:00
Andrej Karpathy 82d7907214 adjust comment 2024-04-28 00:05:03 +00:00
Andrej Karpathy 9a91b40207 bring back original ordering. i also had to bump the thresholds by 3X for some tensors and i don't exactly know why sad 2024-04-28 00:02:51 +00:00
ademeure 8768f6bd74 Full BF16 including layernorm at good perf by minimising BF16 atomics 2024-04-28 00:31:42 +01:00
Andrej Karpathy 00627070aa fix a really bad bug in how i was checking the gradients, where i loaded them in the old order, so yeah... 2024-04-27 23:17:22 +00:00
Andrej Karpathy a58b8d5dc7 print more in the comparison 2024-04-27 16:04:55 +00:00
Andrej Karpathy 9d6fd30e3c tweak the tolerances until we pass lol 2024-04-27 15:49:54 +00:00
Andrej Karpathy e067a27395 fix dumb bug. i'll blame github copilot but i can't remember 2024-04-27 15:40:32 +00:00
Andrej Karpathy d4a642ba19 i think github copilot betrayed me on this index here, i cant remember 2024-04-27 15:38:20 +00:00
Andrej Karpathy 09d935c82b i think i am making things cleaner, but i am not fixing the problem 2024-04-27 15:27:05 +00:00
Andrej Karpathy 09cd67e868 code to load bf16 weights directly, and also re-wire the position of tensors to put the layernorms at the end. the training loop seems to work ok, and the tests pass and the loss and optimization looks ok, but the gradients don't match. which can't be right. so there is a bug, but it's a bit too late in the day for me to debug right now, creating a PR and going to sleep, will fix tomorrow 2024-04-27 00:54:06 +00:00
Andrej Karpathy 0b59d80880 not proud of this but i have to increase the threshold for now to make test pass. later we should come back around and tighten thresholds 2024-04-23 18:13:57 +00:00
ademeure 7c193bd4cc Good news: it works. Bad news: 16-bit atomics are *incredibly slow* :( (is it doing CAS?) 2024-04-23 05:00:47 +01:00
ademeure 85290a5228 Updated FP16/BF16 mix-and-match ncluding stochastic rounding 2024-04-23 01:39:33 +01:00
ademeure 58df2629ae Gradients now working in BF16 mode! (still need adam etc...) 2024-04-22 18:09:18 +01:00
Erik Schultheis 0636bc4ee3 removed the union and moved the logit->probability conversion into the sampling function 2024-04-21 16:45:46 +03:00
Erik Schultheis 7f3272c38f unionize output buffer 2024-04-21 02:11:41 +03:00
Erik Schultheis 24dd728953 only need one V-sized buffer that can switch from logits to dlogits in the fused backward pass 2024-04-20 20:19:16 +03:00
Andrej Karpathy 954077fb88 TRAINING WORKSgit add train_gpt2.cu! ITS SLOW BUT IT WORKS WOOT 2024-04-17 04:58:37 +00:00
Andrej Karpathy 3f24ac961d check the entire gradient tensor all at once nice 2024-04-17 04:41:58 +00:00
Andrej Karpathy fd6882a1e3 encoder backward really naive, just to get this finished full 2024-04-17 04:39:02 +00:00
Andrej Karpathy a3a3b82d82 also backward the attention, that was not easy lol 2024-04-17 04:23:08 +00:00
Andrej Karpathy 45b0df0d3a backward now up to and not including attention 2024-04-16 20:34:13 +00:00
Andrej Karpathy e96f0ee2c8 backward the layernorm 2024-04-16 20:31:21 +00:00
Andrej Karpathy bf4ac57adc backward the gelu and the matmul after 2024-04-16 20:29:08 +00:00