Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Alongside it sits a parallel PyTorch implementation in [engine/main.py](engine/m

The point of this repo is the C++ core. The PyTorch, FastAPI, and frontend layers exist to make the model usable, but if you're here to learn how a GPT is actually built and trained without a framework doing the work for you, [include/backward.h](include/backward.h) is where to start reading.

<h1 align="center">
<img width="824" height="250" alt="image" src="https://github.com/user-attachments/assets/5c65daa2-903a-4392-85e3-56442bb82cac" />


</h1>

***technical notes***: [docs](https://eamon2009.github.io/LLMs/)


Expand Down
Binary file added assets/run_2026-07-16 165731.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions engine/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ def success(msg): log(f" ok {msg}")

device = 'cuda' if torch.cuda.is_available() else 'cpu'
dropout = 0.1
block_size = 256
n_embd = 192
n_head = 6
n_layer = 6
batch_size = 64
max_iters = 5000
eval_interval = 250
learning_rate = 6e-4
eval_iters = 200
dropout = 0.1
block_size = 256
n_embd = 192
n_head = 6
n_layer = 6
batch_size = 64
max_iters = 5000
eval_interval = 250
learning_rate = 6e-4
eval_iters = 200
dropout = 0.1

torch.manual_seed(seed)


# tokenizer

def get_tokenizer(encoding_name="o200k"):
def get_tokenizer(encoding_name="o200k_base"):
tokenizer = tiktoken.get_encoding(encoding_name)
vocab_size = tokenizer.n_vocab
return tokenizer, vocab_size
Expand All @@ -96,7 +96,7 @@ def decode(tokens, tokenizer): return tokenizer.decode(tokens)
with open(cleaned_path, 'r', encoding='utf-8') as f:
text = f.read()

tokenizer, vocab_size = get_tokenizer("o200k")
tokenizer, vocab_size = get_tokenizer("o200k_base")
encoded_data = encode(text, tokenizer)

data = torch.tensor(encoded_data, dtype=torch.long)
Expand Down
Loading