プログラミング
純粋なCMakeでのGPT-2の実装
Implementation of GPT-2 in pure CMake (github.com)
要約
このGitHubリポジトリは、純粋なCMakeのみを使用してGPT-2モデルを実装したプロジェクトを紹介しています。Q16.16整数演算を使用しており、完全なモデルとトイモデルの両方の実装が含まれています。モデルのダウンロード方法やCMakeコマンドによる実行手順も説明されています。
全文翻訳
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条項。LICENSEを参照してください。