cd /news/large-language-models/implementation-of-gpt-2-in-pure-cmak… · home topics large-language-models article
[ARTICLE · art-108088] src=github.com ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Implementation of GPT-2 in pure CMake

AlpinDale released gpt2.cmake, an implementation of OpenAI's GPT-2 language model written entirely in CMake, using Q16.16 fixed-point integer arithmetic to run inference without floating-point operations. The project, licensed under BSD 3-Clause, loads the GPT-2 model from Hugging Face and generates text via CMake scripts, as demonstrated with the command 'cmake -P gpt2.cmake -DPROMPT="Hello" -DN=2'.

read1 min views1 publishedAug 23, 2026
Implementation of GPT-2 in pure CMake
Image: Michielbdejong (auto-discovered)

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.

Name Name Last commit date

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

␃WPNCODE0␃

␃WPNCODE1␃

BSD 3-Clause. See LICENSE.

── more in #large-language-models 4 stories · sorted by recency
── more on @alpindale 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/implementation-of-gp…] indexed:0 read:1min 2026-08-23 ·