# Implementation of GPT-2 in pure CMake

> Source: <https://github.com/AlpinDale/gpt2.cmake>
> Published: 2026-08-23 21:41:17+00:00

GPT-2 in pure CMake, executed with Q16.16 integer arithmetic.

```
mkdir -p checkpoint
curl -L -o checkpoint/model.safetensors https://huggingface.co/openai-community/gpt2/resolve/main/model.safetensors
curl -L -o checkpoint/vocab.json      https://huggingface.co/openai-community/gpt2/resolve/main/vocab.json
curl -L -o checkpoint/merges.txt      https://huggingface.co/openai-community/gpt2/resolve/main/merges.txt
python3 tools/gen_full.py
cmake -P gpt2_full.cmake -DPROMPT="Hello" -DN=2
python3 tools/gen_tables.py
python3 tools/gen_model.py
cmake -P gpt2.cmake
```

BSD 3-Clause. See [LICENSE](/AlpinDale/gpt2.cmake/blob/main/LICENSE).

| Name | Name | Last commit date | ||
|---|---|---|---|---|

GPT-2 in pure CMake, executed with Q16.16 integer arithmetic.

␃WPNCODE0␃

␃WPNCODE1␃

BSD 3-Clause. See [LICENSE](/AlpinDale/gpt2.cmake/blob/main/LICENSE).
