使用纯 CMake 实现 GPT-2
Implementation of GPT-2 in pure CMake

原始链接: https://github.com/AlpinDale/gpt2.cmake

使用纯 CMake 实现的 GPT-2,采用 Q16.16 定点数运算。 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 许可证。详情请参阅 LICENSE 文件。

GitHub 上近期出现了一个用“纯 CMake”编写的 GPT-2 实现,在 Hacker News 上引发了热烈讨论。用户们对该项目表现出一种集娱乐、惊恐与敬畏于一身的复杂情绪,将其比作在计算器上运行《毁灭战士》或利用 C++ 模板进行图灵完备计算等荒诞的技术壮举。 评论者指出了该实现极端的性能局限,指出 CMake 是一种解释型的“字符串类型”语言,并不适合神经网络繁重的数学计算需求。该项目是单线程的,且需要不断的字符串到数字转换,导致其运行速度极其缓慢。 尽管在技术上并不实用,但社区大体上将这一尝试视为一种“荒诞艺术”。虽然有些人质疑作者的理智,但大多数反应都带有调侃意味,将其视为一场令人印象深刻的技术受虐秀。该讨论串捕捉到了开发者实验精神的精髓:仅仅因为可以实现,就去做一些困难且在技术上存疑的事情,而不论其结果看起来多么“糟糕”或“恶心”。
相关文章

原文

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.

联系我们 contact @ memedata.com