메뉴
HN
Hacker News • 33일 전

순수 CMake만으로 GPT-2 구현

IMP
3/10
핵심 요약

빌드 시스템 언어인 CMake만을 사용해 GPT-2 언어모델을 구현한 프로젝트가 해커뉴스에 공개되었습니다. Q16.16 고정소수점 정수 연산으로 추론을 수행하며, Hugging Face의 GPT-2 체크포인트를 그대로 사용해 전체 모델과 토이 모델 모두 실행할 수 있습니다. BSD 3-Clause 라이선스로 오픈소스 공개되었습니다.

번역된 본문

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 파일 참조.

원문 보기
원문 보기 (영어)
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 .