AlpinDale/gpt2.cmake

Implementation of the GPT-2 model in pure CMake

109

stars

1

commits

CMake

primary language

Aug 23, 2026

updated

README

gpt2.cmake

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

Full model

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

Toy model

python3 tools/gen_tables.py
python3 tools/gen_model.py
cmake -P gpt2.cmake

License

BSD 3-Clause. See LICENSE.

Contributors

AlpinDale

1 commits

AlpinDale/gpt2.cmake

Implementation of the GPT-2 model in pure CMake

109

stars

1

commits

CMake

primary language

Aug 23, 2026

updated

README

gpt2.cmake

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

Full model

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

Toy model

python3 tools/gen_tables.py
python3 tools/gen_model.py
cmake -P gpt2.cmake

License

BSD 3-Clause. See LICENSE.

See what people are saying

Contributors

AlpinDale

1 commits

Languages

CMake

81.8%

Python

18.2%