padding 50257 -> 50304 vocab_size, the nerest multiple of 64. the biggest deal smallest optimization i've made in recent past, about 25% faster. this is because the last layer is a major latency bottleneck consuming about 40% of latency due to the very high channel count.

This commit is contained in:
Andrej Karpathy committed 2023-02-04 16:06:18 +00:00
1 parent b3c17c6c6a
commit 77e7e04c26
3 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -128,8 +128,8 @@ if os.path.exists(meta_path):
vocab_size = meta['vocab_size']
print(f"vocab_size = {vocab_size} (from {meta_path})")
else:
print(f"vocab_size not found in {meta_path}, using GPT-2 default of 50257")
vocab_size = 50257
print(f"vocab_size not found in {meta_path}, using GPT-2 default of 50257 (rounded up to 50304 for efficiency)")
vocab_size = 50304
# model init
model_args = dict(n_layer=n_layer, n_head=n_head, n_embd=n_embd, block_size=block_size,