Commit Graph

676 Commits

Author SHA1 Message Date
github-actions[bot]
b10b10a79b docs: add @Roldao-Neto as tinytorch contributor for bug 2026-03-04 15:11:50 +00:00
github-actions[bot]
38188ea69c docs: add @Roldao-Neto as tinytorch contributor for code 2026-03-04 12:16:38 +00:00
Vijay Janapa Reddi
a7f9367e42 Merge dev into feature/book-volumes: CI, contributors, workflows
# Conflicts:
#	README.md
2026-03-02 09:38:47 -05:00
Vijay Janapa Reddi
48b519c42e Merge feature/tinytorch-core into feature/book-volumes
# Conflicts:
#	README.md
#	tinytorch/src/01_tensor/01_tensor.py
#	tinytorch/src/15_quantization/ABOUT.md
2026-03-02 09:38:08 -05:00
Vijay Janapa Reddi
bf9c402827 Adds callout-definition blocks to all Vol.2 chapters and fixes pre-commit hook errors
- Adds standardized callout-definition blocks with bold term + clear definition
  to all Vol.2 chapters (distributed training, inference, network fabrics, etc.)
- Fixes caption_inline_python errors: replaces Python inline refs in table
  captions with static text in responsible_engr, appendix_fleet, appendix_reliability,
  compute_infrastructure
- Fixes undefined_inline_ref errors: adds missing code fence for PlatformEconomics
  class in ops_scale.qmd; converts display math blocks with Python refs to prose
- Fixes render-pattern errors: moves inline Python outside $...$ math delimiters
  in conclusion, fleet_orchestration, inference, introduction, network_fabrics,
  responsible_ai, security_privacy, sustainable_ai, distributed_training
- Fixes dropcap errors: restructures drop-cap sentences in hw_acceleration and
  nn_architectures to not start with cross-references
- Fixes unreferenced-label errors: removes @ prefix from @sec-/@tbl- refs inside
  Python comment strings in training, model_compression, ml_systems
- Adds clientA to codespell ignore words (TikZ node label in edge_intelligence)
- Updates mlsys constants, hardware, models, and test_units for Vol.2 calculations
- Updates _quarto.yml and references.bib for two-volume structure
2026-03-01 10:44:33 -05:00
Vijay Janapa Reddi
3697fb7bf8 Merge remote-tracking branch 'origin/dev' into dev 2026-02-28 14:21:48 -05:00
kai
81373c5dd7 bug fix user manual account broken 2026-02-27 17:06:38 -05:00
kai
5ae6b3bd5f updated calendar to pull from real cal, account deletions enabled 2026-02-27 01:26:24 -05:00
Vijay Janapa Reddi
2de66f1c0f refactor: complete Gold Standard audit for core foundation chapters; unify Volume 1 and Volume 2 math; verify physical realism of hardware constants 2026-02-25 08:31:21 -05:00
Vijay Janapa Reddi
a78f5dd893 Merge pull request #1201 from harvard-edge/fix/ch15 and resolve README conflict 2026-02-25 08:27:02 -05:00
github-actions[bot]
130d3cc133 docs: add @adityamulik as tinytorch contributor for doc 2026-02-25 13:09:27 +00:00
Aditya Mulik
e5d8395265 The multiplication process example is corrected 2026-02-25 05:24:01 -05:00
Vijay Janapa Reddi
ecb3af7fd2 fix(ci): pull before push in all-contributors workflow; add @salmanmkc to tinytorch and kits
- Add git pull --rebase before push so concurrent comment-triggered runs
  don't reject each other (only one of three runs had succeeded for PR 1179).
- Manually add @salmanmkc as code contributor to tinytorch and kits
  (labs was already added by the single successful run).
2026-02-22 14:05:31 -05:00
Vijay Janapa Reddi
ab697a84f2 refactor(milestones): use stdlib tar filter='data' for safe CIFAR-10 extraction 2026-02-22 13:40:09 -05:00
Vijay Janapa Reddi
3a149a06a6 Merge pull request #1182 from RinZ27/fix/safe-data-extraction
Improve dataset extraction robustness
2026-02-22 13:34:06 -05:00
Vijay Janapa Reddi
ddbc0a45e3 Merge branch 'dev' of https://github.com/harvard-edge/cs249r_book into dev 2026-02-22 13:22:49 -05:00
Vijay Janapa Reddi
85c0cd4c83 Merge branch 'feature/tinytorch-core' into dev 2026-02-22 13:22:37 -05:00
Vijay Janapa Reddi
1733596996 style(module 19): fix table alignment in MLPerf benchmark docs 2026-02-22 13:22:31 -05:00
Vijay Janapa Reddi
55007e1f6e docs(module 19): add educational purposes disclaimer for MLPerf 2026-02-22 13:20:12 -05:00
Vijay Janapa Reddi
68d446edcf docs(module 19): add MLPerf trademark attribution and pedagogical framing
- MLPerf® is a trademark of MLCommons
- This module teaches the principles of MLPerf-style benchmarking
2026-02-22 13:19:43 -05:00
Vijay Janapa Reddi
335bad8cd0 fix(module 19): address benchmarking feedback from issue #1196
- Fix Pareto diagram: swap A/C so line has positive slope (latency vs accuracy)
- Add missing Image Classification writeup to Standard Benchmark Tasks
- Treat anomaly_detection as binary classification (np.rand(2))
- Convert MLPerf inputs to Tensors + transpose HWC→CHW for TinyTorch models

Fixes harvard-edge/cs249r_book#1196
2026-02-22 13:18:08 -05:00
Vijay Janapa Reddi
9ab80d7cc0 fix: replace broken research paper link with arXiv PDF
The GitHub link (github.com/harvard-edge/TinyTorch/blob/main/paper/paper.pdf)
returns 404. Use arxiv.org/pdf/2601.19107 instead.

Fixes harvard-edge/cs249r_book#1198
2026-02-22 12:52:11 -05:00
github-actions[bot]
8c373dfc58 docs: add @Pratham-ja as tinytorch contributor for code, bug 2026-02-21 14:42:31 +00:00
Vijay Janapa Reddi
94d079b57c Merge feature/tinytorch-core into dev (fixes #1184) 2026-02-21 09:39:50 -05:00
Vijay Janapa Reddi
d7d288dace Fix UnicodeDecodeError on Windows in tito module complete (fixes #1184)
Add encoding='utf-8' and errors='replace' to subprocess.run() calls in
workflow.py so unit and integration test output decode correctly on
Windows (cp1252) when output contains UTF-8 characters.

Co-authored-by: Pratham-ja <114498234+Pratham-ja@users.noreply.github.com>
2026-02-21 09:38:08 -05:00
Vijay Janapa Reddi
69f46d4f7e Clarifies memoization computation savings
Refines the explanation of K,V computation savings in the memoization module,
quantifying redundant computations and highlighting the efficiency gain.

The paper and module now specify that generating 100 tokens requires 5,050
total K,V computations, but only 100 are necessary, resulting in 4,950
redundant calculations.
2026-02-19 17:59:10 -05:00
github-actions[bot]
68167c3d1b docs: add @Pratham-ja as tinytorch contributor for doc 2026-02-19 22:43:52 +00:00
unknown
5f7a696077 Improve activation graph visualization in Module 02
- Clarify node labeling
- Improve spacing for readability
- No API changes
2026-02-20 03:48:10 +05:30
RinZ27
7d2cd5a47d Improve robustness of dataset extraction by validating paths 2026-02-19 22:57:20 +07:00
github-actions[bot]
f655cdfbba chore(tinytorch): bump version to tinytorch-v0.1.9 2026-02-18 00:02:21 +00:00
github-actions[bot]
d69a8d6f1d docs: add @sotoblanco as tinytorch contributor for doc 2026-02-17 23:43:01 +00:00
Vijay Janapa Reddi
850a91adc6 fix(docs): align notebook filenames with tito convention across all docs
Notebooks use short names (tensor.ipynb, not 01_tensor.ipynb) but docs
and Binder postBuild scripts used the prefixed form. This caused broken
Binder links and incorrect paths in troubleshooting guides.

Fixes: harvard-edge/cs249r_book#1176
2026-02-17 18:31:44 -05:00
Vijay Janapa Reddi
336f03e1c0 fix(site): update notebook filename in getting-started guide 2026-02-17 18:19:58 -05:00
Vijay Janapa Reddi
e7f9223680 feat(site): convert all 20 ABOUT.md files to MyST notebooks with computed values
Replace hardcoded numerical values across all module ABOUT.md files with
Python-computed values using myst_nb glue() references. Each file is now a
MyST Markdown Notebook that executes inline code cells to compute memory
sizes, FLOPs, compression ratios, and other quantitative values.

Key changes:
- Add file_format: mystnb frontmatter and code-cell blocks to all 20 files
- All arithmetic (memory calculations, speedups, ratios) now computed inline
- Fix multiple arithmetic errors discovered during conversion
- Enable execute_notebooks: "cache" in PDF config for glue resolution
- Fix jupyter-book version constraint in Makefile
2026-02-17 18:11:31 -05:00
Vijay Janapa Reddi
672eee9618 fix(pdf): cap Mermaid figure sizes and fix nested code fences
Mermaid diagrams were oversized in PDF output. Reduced viewport width
from 800→600 and added LaTeX preamble to cap mermaid figures at
0.75\linewidth. Also fixed 7 admonition blocks across 5 ABOUT.md files
where nested triple-backtick code fences broke the MyST parser, causing
raw markdown to render in PDF output.
2026-02-17 15:15:56 -05:00
Vijay Janapa Reddi
c13c4c6b9c fix: align MLPerf box-drawing in benchmarking module, set tree indent
- Fix misaligned ASCII art in Module 19 benchmark architecture diagram
- Set default workbench.tree.indent to 16px in VS Code extension
2026-02-17 13:53:32 -05:00
Vijay Janapa Reddi
e0f910ae5b style(site): improve navbar responsiveness and version badge layout
- Responsive progressive disclosure: hide date at 1024px, icons-only at 768px
- Add 44px touch targets for mobile nav links
- Restyle version badge with separate number/date spans
- Add link-secondary class for visual hierarchy in navbar
2026-02-17 13:53:26 -05:00
Vijay Janapa Reddi
2b27429892 fix(site): PDF build improvements and community section
- Add npx pre-flight check for Mermaid CLI in PDF build
- Configure mermaid_cmd to use npx (no global install needed)
- Add Unicode box-drawing fallbacks for LaTeX
- Add Community section to PDF table of contents
2026-02-17 13:53:18 -05:00
Vijay Janapa Reddi
9cee0e9b83 fix(vscode-ext): open notebooks in interactive editor instead of raw JSON
Use vscode.openWith(uri, 'jupyter-notebook') for .ipynb files so they
render in VS Code's notebook editor with cell support, rather than
opening as raw JSON text via openTextDocument.
2026-02-17 12:35:42 -05:00
Vijay Janapa Reddi
672a35335f feat(vscode-ext, tito): make extension a thin client over Tito CLI
The VS Code extension no longer implements any business logic — every
capability (module discovery, path resolution, system info, builds,
tests, clean) lives in Tito CLI commands. The extension is a pure UI
shell that delegates via `python3 -m tito.main`.

Tito CLI additions:
- `module list --json` for machine-readable module discovery
- `module path <num> --notebook|--source|--about` for file resolution
- `system info --json` for environment info
- `dev build html|serve|pdf|paper` wrapping make targets
- `dev clean [all|site]` wrapping make clean
- Banner suppression for --json and module path output

Extension hardening:
- Centralized CLI integration in utils/tito.ts (single TITO_CMD constant,
  callTito, callTitoJson, titoTerminalCommand, isTitoAvailable, log/logError)
- Replaced all silent catch{} blocks with logged errors and user feedback
- Module tree shows error/empty states with actionable Setup/Health buttons
- Info tree shows "Tito CLI unavailable" when CLI is unreachable
- Removed all setTimeout refresh hacks — file watcher on .tito/progress.json
  is the sole refresh mechanism
- Exit code tracking via onDidEndTerminalShellExecution
- Tito availability pre-flight check on activation
- BUILD_OUTPUTS constants for build artifact paths
- Zero execSync calls outside tito.ts, zero hardcoded command strings
2026-02-17 10:08:00 -05:00
Vijay Janapa Reddi
9f2cce16d2 fix(docs): update TITO reference docs to match actual CLI commands
- Fix setup flow across all docs (activate.sh → source .venv/bin/activate,
  setup-environment.sh → tito setup)
- Add missing commands to overview (tito setup, system update/reset,
  module list/view/test, milestone test/demo, nbgrader commands)
- Add module list, view, and test sections to modules.md
- Fix phantom AlexNet milestone → XOR Crisis in data.md
- Fix Module 10 name (Normalization → Tokenization) in data.md
- Fix milestones.md prereq check output (missing Module 08)
- Fix troubleshooting.md paths, permission fix, and quick-reference table
2026-02-16 14:30:44 -05:00
Vijay Janapa Reddi
53066bf5af feat(site): add version badge to navbar with auto-update on release
Display version number and release date (e.g., "v0.1.8 · Feb 7, 2026")
next to the "Under Construction" badge in the top nav bar. Version and
date are declared as top-of-file constants in wip-banner.js for easy
CI sed updates. Publish workflow now bumps 6 files instead of 5.
2026-02-16 12:43:09 -05:00
Vijay Janapa Reddi
09de699545 fix(exports): add missing #| export directives across 10 modules
Systematic audit of all 20 modules against module-developer agent rules
found 9 standalone helper functions missing #| export — these are called
by exported code at runtime but were excluded from the generated package,
causing NameError/AttributeError in CI.

Modules fixed:
- 05_dataloader: _pad_image, _random_crop_region (used by RandomCrop)
- 06_autograd: _stable_softmax, _one_hot_encode (prior session)
- 07_optimizers: 5 mixin classes + monkey-patches (prior session)
- 08_training: 7 monkey-patched Trainer methods (prior session)
- 10_tokenization: _count_byte_pairs, _merge_pair (used by BPETokenizer)
- 11_embeddings: _compute_sinusoidal_table (prior session)
- 12_attention: _compute_attention_scores, _scale_scores, _apply_mask (prior)
- 15_quantization: _collect_layer_inputs, _quantize_single_layer (used by quantize_model)
- 18_memoization: _cached_generation_step, _create_cache_storage, _cached_attention_forward (used by enable_kv_cache)
- 19_benchmarking: rename TinyMLPerf→MLPerf, fix monkey-patch naming (prior)

Also includes: vscode-ext icon refactor (ThemeIcon migration).

All 789 tests pass (unit, integration, e2e, CLI).
2026-02-15 17:38:03 -05:00
Vijay Janapa Reddi
a6bd9496e3 style(vscode-ext): increase indentation for action tree rows
Offset action labels in the sidebar tree so child commands are visually nested more clearly under each category across all views.
2026-02-15 14:12:03 -05:00
Vijay Janapa Reddi
58a1391431 Merge remote-tracking branch 'origin/dev' into feature/tinytorch-core 2026-02-15 14:09:07 -05:00
Vijay Janapa Reddi
d33e61b8cc chore(vscode-ext): ignore generated extension artifacts
Ignore extension build outputs and packaged artifacts so the branch stays clean after local development and commit hooks only evaluate source files.
2026-02-15 14:02:41 -05:00
Vijay Janapa Reddi
910240a3f6 chore(tinytorch): add VS Code extension and sync module updates
Add the TinyTorch VS Code extension source package and align module code/docs references so APIs, milestones, and progression notes remain consistent across the curriculum.
2026-02-15 14:02:09 -05:00
Vijay Janapa Reddi
fd7cab5c75 refactor(modules): decompose oversized solution blocks for pedagogical consistency
Break down large BEGIN/END SOLUTION blocks (45+ lines) into smaller,
unit-testable pieces following the one-concept-per-block principle:

- Module 08: train_epoch (58 lines) -> _process_batch + _optimizer_update + train_epoch
- Module 09: BatchNorm2d.forward (70 lines) -> _validate_input + _get_stats + forward
- Module 11: Embedding (62 lines) -> __init__ + forward; PositionalEncoding (82 lines) -> __init__ + forward
- Module 19: generate_report (108 lines), generate_compliance_report (86 lines),
  _run_accuracy_test (52 lines) each decomposed into helper + composition

Each new helper has its own unit test, all test_module() functions updated,
naming conventions enforced (_prefix for private monkey-patch targets).
2026-02-15 10:37:39 -05:00
Vijay Janapa Reddi
9c1ca3e441 style(tinytorch): standardize formatting and conventions across all 20 modules
Audit and fix consistency issues across all module source files:

- Standardize ML Systems header to "ML Systems Reflection Questions" (01, 13)
- Fix section ordering: test_module before ML Systems in modules 16, 17
- Rename demo_spatial() to demo_convolutions() to match module name (09)
- Rename demo_*_with_profiler() to explore_*_with_profiler() (15, 16, 17)
- Fix test naming to use test_unit_* prefix consistently (03, 05, 11, 12)
- Add missing emojis in test_module/demo patterns (02, 15)
- Standardize tito command format to number-only (01, 03, 06, 07, 18)
- Fix implementation headers: hyphen to colon separator (09, 12)
- Add missing "Where This Code Lives" package section (13)
- Fix export command in module summary (05, 06)
2026-02-15 09:37:25 -05:00
Vijay Janapa Reddi
81cdbba67b refactor(tinytorch): function decomposition, naming conventions, and progressive disclosure
Three categories of changes across 17 modules:

1. Function decomposition (Modules 01,03,05-15,18-19): Break large
   monolithic functions into focused _helper + orchestrator pattern.
   Each helper teaches one concept with its own unit test.

2. Naming convention fixes (Modules 08,09,11,18,19): Ensure underscore
   convention is consistent — standalone _func in export cells renamed
   to func (public API), monkey-patched method names match target
   visibility, removed unnecessary #| export from internal helpers.

3. Progressive disclosure (Modules 02-05,08,11-15): Remove forward
   references to future modules. Replace "you'll learn in Module N"
   with concrete descriptions. Trim connection maps to only show
   current and prior modules. Keep end-of-module "Next" teasers
   as motivational breadcrumbs.

All 17 modified modules pass their test suites.
2026-02-14 16:52:15 -05:00