The best ChatGPT that $100 can buy.
Python
add a comment clarifying that RoPE here rotates by -theta (transpose of the textbook convention), which is functionally equivalent. Prompted by #489, thank you @qdrk
Andrej Karpathy3616a02925b4
diff --git a/nanochat/gpt.py b/nanochat/gpt.pyindex 07a1eae..f266a43 100644--- a/nanochat/gpt.py+++ b/nanochat/gpt.py@@ -55,6 +55,8 @@ def has_ve(layer_idx, n_layer):return layer_idx % 2 == (n_layer - 1) % 2def apply_rotary_emb(x, cos, sin):+ # note: this rotates by -theta, the transpose of the textbook convention. Functionally+ # equivalent (only the relative q/k rotation matters), kept for checkpoint compatibility.assert x.ndim == 4 # multihead attentiond = x.shape[3] // 2x1, x2 = x[..., :d], x[..., d:] # split up last dim into two halves