LonglongaaaGo/from-the-first-token
소개
From the First Token: bilingual book, guided exercises, runnable examples and teaching data
학습 및 교육측정된 스타 증가
- in 24h
- 0
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalFrom the First Token
Building Language Models from Scratch · Wanglong Lu · Public reading edition
The book contains ten chapters and 71 sections, with reader PDFs, illustrations, and 70 numbered exercises with supplied checks.
The book and illustrations use CC BY-NC-ND 4.0; teaching code uses PolyForm Noncommercial 1.0.0. See LICENSE.md and NOTICE.md for the scope of each license.
Read and implement
Start with the English reading snapshot, with the Chinese edition alongside it. Follow EXERCISES.md in numerical order. Section 03.04 is conceptual and has no separate exercise. Every assigned function is a fresh TODO, so this is not a complete solution package. Supplied drivers test the illustrated cases, not universal correctness. Later drivers can stop in an unfinished prerequisite.
The exercise baseline is Python 3.11, PyTorch 2.0.0 and NumPy 1.x. CPU execution is sufficient. From this package's root:
python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
python exercises/01_01_text_to_tokens.py --check encode
The first run raises NotImplementedError, the exercise's starting point. Read the contract and hints, implement the region marked START LEARNER CODE, and rerun the check. If a later exercise reports an unfinished prerequisite, complete that earlier assignment first. All supplied examples run on CPU.
Runnable teaching example and paired data
The package also includes a complete CPU example and paired synthetic data. Read the English walkthrough, with Simplified Chinese alongside it, then run:
python tools/check_package.py
python examples/generate_teaching_data.py --check
python examples/train_bigram.py --check
The package check prints status: PASS on success. The 76 assigned functions remain TODOs; the complete example supplies its own implementation. This example uses one character of context. See the data guide for its source, generator and fixed split.
The integrity check applies to the files as downloaded. After implementing an exercise, use that exercise's supplied check driver.
Questions and corrections
For corrections or questions, include the relevant chapter or exercise.
Reader PDF downloads
This GitHub source tree keeps large PDFs in the versioned release assets. The complete ZIP and both PDFs belong to the same companion release.
관련 프로젝트 살펴보기
불러오는 중…