高校1年生(数学IA履修程度)を対象に,大規模言語モデル(LLM)・GPTの仕組みを,数学とプログラミングの初歩から順番に作って学ぶ教材です。Google Colabで動かせます。
This is learning material that builds up LLM/GPT from basic math and programming, one piece at a time. It runs on Google Colab.
- 上のバッジからGoogle Colabで開き,「ファイル → ドライブに保存」で自分のコピーを作ります
- 最初に「共通準備」セルを実行し,そのあと上から順番に実行します(順番どおりに実行すれば,そのまま最後まで動きます)
- [アニメーション]の動画やグラフは実行結果として保存済みなので,実行しなくても見られます
- 学習データとグラフ用フォントは実行時に自動でダウンロードされます(インターネット接続が必要です)
- Open it in Google Colab with the badge above, then use "File → Save a copy in Drive" to make your own copy.
- Run the "common setup" cell first, then run the cells in order from top to bottom.
- The [Animation] videos and figures are saved in the notebook, so you can view them without running anything.
- The training data and the graph font are downloaded automatically when you run the cells.
*.ipynb: 教材本体(Colab向けノートブック)_build/: ノートブックの生成スクリプト一式(教材の修正はここの章ファイルch00.py〜ch11.py,appendix.pyを行います)
py _build/nbbuild.py # 章ファイルからノートブックを組み立て直す(出力なし)
py _build/nbbuild.py --run # 組み立てたうえで全セルを実行し,実行結果(動画・グラフ)も再生成する
py _build/inspect_nb.py # 実行後のエラーと各セルの出力を確認する- Andrej Karpathy, microgpt.py (GitHub Gist): この教材のコードの元になったプログラム
- shuheilocale, japanese-personal-name-dataset: 学習データ(MIT License)
- IBM Plex Sans JP: グラフ・動画の日本語フォント(SIL Open Font License)
- manim / 3Blue1Brown: アニメーションの描画ライブラリ