add torch.compile by default, shows almost 1.8X improvement in throughput nice

This commit is contained in:
Andrej Karpathy committed 2022-12-30 00:07:13 +00:00
1 parent fb52554ca8
commit 5a725d9098
4 files changed
+19 -3

No files matched your search

+5 -2
View File
@@ -8,8 +8,7 @@ The simplest, fastest repository for training/finetuning medium-sized GPTs. It's
Dependencies:
- [pytorch](https://pytorch.org) <3
- numpy <3
- `pip install datasets` for huggingface datasets <3
- `pip install datasets` for huggingface datasets <3 (if you want to download + preprocess OpenWebText)
- `pip install tiktoken` for OpenAI's fast bpe code <3
- `pip install wandb` for optional logging <3
@@ -68,6 +67,10 @@ I briefly tried finetuning gpt2 a bit more on our OWT and didn't notice dramatic
For model benchmarking `bench.py` might be useful. It's identical what happens in the meat of the training loop of `train.py`, but omits much of the other complexities.
# efficiency notes
Code by default now uses [PyTorch 2.0](https://pytorch.org/get-started/pytorch-2.0/). At the time of writing (Dec 29, 2022) this makes `torch.compile()` available in the nightly release. The improvement from the one line of code is noticeable, e.g. cutting down iteration time from ~250ms / iter to 135ms / iter. Nice work PyTorch team!
## todos
A few that I'm aware of, other than the ones mentioned in code: