LonglongaaaGo/from-the-first-token
Tentang
From the First Token: bilingual book, guided exercises, runnable examples and teaching data
Pembelajaran dan pendidikanPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- Mengumpulkan riwayat
- dalam 15 hari
- Mengumpulkan riwayat
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliFrom 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.
Jelajahi proyek terkait
Memuat…