Commit Graph

250 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
4ae406160d feat: add Quarto equation labels and cross-references across Vol 1
Add proper equation labels ({#eq-...}) and prose references (@eq-...)
to 138 equations across 15 Volume 1 chapters following the gold-standard
pattern from serving.qmd.

Key changes:
- Label all display math equations with {#eq-kebab-case-name}
- Add @eq-name references in prose before each equation
- Equations include: Iron Law, Amdahl's Law, Roofline Model,
  activation functions, backpropagation, attention mechanisms,
  queuing theory, quantization, and system throughput formulas

Also includes:
- PDF formatting improvements (newpage directives for Vol 2)
- LaTeX header updates for chapter styling
- Pre-commit config and validation script updates
2026-02-07 09:40:01 -05:00
Vijay Janapa Reddi
7b92e11193 Repository Restructuring: Prepare for TinyTorch Integration (#1068)
* Restructure: Move book content to book/ subdirectory

- Move quarto/ → book/quarto/
- Move cli/ → book/cli/
- Move docker/ → book/docker/
- Move socratiQ/ → book/socratiQ/
- Move tools/ → book/tools/
- Move scripts/ → book/scripts/
- Move config/ → book/config/
- Move docs/ → book/docs/
- Move binder → book/binder

Git history fully preserved for all moved files.

Part of repository restructuring to support MLSysBook + TinyTorch.

Pre-commit hooks bypassed for this commit as paths need updating.

* Update pre-commit hooks for book/ subdirectory

- Update all quarto/ paths to book/quarto/
- Update all tools/ paths to book/tools/
- Update config/linting to book/config/linting
- Update project structure checks

Pre-commit hooks will now work with new directory structure.

* Update .gitignore for book/ subdirectory structure

- Update quarto/ paths to book/quarto/
- Update assets/ paths to book/quarto/assets/
- Maintain all existing ignore patterns

* Update GitHub workflows for book/ subdirectory

- Update all quarto/ paths to book/quarto/
- Update cli/ paths to book/cli/
- Update tools/ paths to book/tools/
- Update docker/ paths to book/docker/
- Update config/ paths to book/config/
- Maintain all workflow functionality

* Update CLI config to support book/ subdirectory

- Check for book/quarto/ path first
- Fall back to quarto/ for backward compatibility
- Maintain full CLI functionality

* Create new root and book READMEs for dual structure

- Add comprehensive root README explaining both projects
- Create book-specific README with quick start guide
- Document repository structure and navigation
- Prepare for TinyTorch integration
2025-12-05 14:04:21 -08:00
Didier Durand
1b4856507c [Doc] typos in .py and CHANGELOG.md (#1066) 2025-12-04 09:54:17 -08:00
Vijay Janapa Reddi
b62fc03472 chore: remove deprecated build scripts directory
Removes tools/scripts/build/ directory containing:
- README.md
- generate_stats.py
- standardize_sources.sh

These scripts appear to have been deprecated or relocated as part of
repository reorganization. The clean.sh script has been moved to
tools/setup/clean.sh.
2025-12-02 21:54:54 -05:00
Vijay Janapa Reddi
0495d81e3a fix(dev): change dev preview banner timestamp from UTC to EST
Updates the development preview banner to display build timestamps in
Eastern Time (EST/EDT) instead of UTC for easier readability. The
timestamp automatically adjusts for daylight saving time using the
America/New_York timezone. Fallback to UTC if timezone handling fails.
2025-12-02 21:44:20 -05:00
Vijay Janapa Reddi
e55363d316 feat: Add comprehensive EPUB validator with epubcheck integration
- Create validate_epub.py utility for EPUB validation
- Integrates official epubcheck validator when available
- Custom checks for CSS variables and XML comment violations
- Detects common XHTML errors (unclosed tags, unescaped characters)
- Validates EPUB structure (mimetype, container.xml, OPF)
- Supports --quick flag to skip epubcheck for faster validation
- Provides detailed error reporting with file paths and line numbers
2025-11-25 09:49:55 -05:00
Vijay Janapa Reddi
bc51497645 cleanup: remove Claude Code author attributions from scripts
Remove 'Author: Claude Code' lines from script docstrings.
These attributions should not be in the repository per project guidelines.
2025-11-11 13:10:51 -05:00
Vijay Janapa Reddi
570f1e9061 cleanup: remove build artifacts, cache files, and empty catalogs
Remove obsolete files that should not be tracked:
- 3 diagram PDF cache files (auto-generated by Quarto)
- 4 empty footnote_catalog.json files

All removed files are build artifacts or empty placeholders
that provide no ongoing value.
2025-11-11 12:59:12 -05:00
Vijay Janapa Reddi
afa6fdd36f Revert "Merge branch 'feature/alt-text-generation' into dev"
This reverts commit 9e2bfe4e64, reversing
changes made to 0b3f04d82d.
2025-11-10 19:57:42 -05:00
Vijay Janapa Reddi
3be298f3d2 Merge branch 'dev' into feature/alt-text-generation 2025-11-10 19:56:52 -05:00
Vijay Janapa Reddi
0b3f04d82d Removes backup file
Deletes the backup file that contains a list of scripts.
This action streamlines the repository and avoids potential
confusion or conflicts arising from outdated file lists.
2025-11-10 19:56:29 -05:00
Vijay Janapa Reddi
1bb5aac313 refactor(lint): use Python built-in json module for validation
Replaced external check-json hook with custom validator using Python's
built-in json module (json.load). Created validate_json.py wrapper to
handle multiple files.

Benefits:
- No external dependencies
- Uses Python's standard library json parser
- Same validation logic as the build system
- Fast and reliable (0.16s for all JSON files)
2025-11-10 13:23:15 -05:00
kai
ab0926a47a socratiQ folder in root. socratiQ folder in tools dedicated to the build. 2025-11-10 07:08:07 -05:00
Vijay Janapa Reddi
c20c73508b feat(accessibility): Add GenAI-powered alt-text generation tools
- Add generate_alt_text.py script for automated image alt-text generation
- Add README_ALT_TEXT.md with detailed usage instructions
- Add QUICK_START_ALT_TEXT.md for quick reference
- Uses Google Gemini API to generate descriptive alt-text for figures

Related to accessibility improvements for image descriptions.
Work in progress - requires GitHub issue tracking.
2025-11-09 16:53:44 -05:00
Vijay Janapa Reddi
37e40dee36 fix(quizzes): correct MCQ answer explanations and add validation (#1035)
Addresses #1034

Fixed 47 instances across 20 quiz files where MCQ answer explanations
incorrectly referenced the correct option as one of the incorrect options.

Changes:
1. Fixed all quiz JSON files with incorrect option references
   - Fixed patterns like 'Options A, C, and D' when A is correct
   - Fixed patterns like 'Option C is incorrect' when C is correct
   - Fixed patterns like 'Option A describes...' when A is correct

2. Created fix_mcq_answer_explanations.py script
   - Automatically detects and fixes incorrect option references
   - Handles plural and singular patterns
   - Can be run on all quiz files or specific files

3. Enhanced quizzes.py with validation and opt-in redistribution
   - Added validate_mcq_option_references() function
   - Validation runs during quiz generation to catch LLM errors
   - MCQ redistribution now requires --redistribute-mcq flag (opt-in)
   - Prevents bug from being reintroduced during answer shuffling

All 445 MCQ questions validated across 35 quiz files.
2025-11-05 15:58:54 -05:00
kai
1c32b2b0ce Updated bundle.js, removing other js files. Updated search to be just '/' 2025-11-03 23:01:49 -05:00
Vijay Janapa Reddi
2c730dda36 feat(tools): add comprehensive spell checking for TikZ diagrams and prose
Add two complementary spell checking tools for content validation:

- check_tikz_spelling.py: Extracts and validates all visible text from
  TikZ diagrams including node labels, inline annotations, custom pics,
  foreach loops, legends, and comments. Uses pattern-based matching for
  common typos with optional aspell integration.

- check_prose_spelling.py: Intelligently parses QMD structure to check
  only actual prose content while excluding YAML frontmatter, code blocks,
  TikZ diagrams, inline code, math expressions, and URLs. Uses aspell with
  comprehensive ignore list of 500+ technical terms and acronyms.

Both tools provide detailed output with file paths, line numbers, and
context for identified spelling errors. The TikZ checker found and enabled
fixing of typos like 'gatewey', 'poihnts', and 'Intellignet' across the
codebase.
2025-11-03 11:01:04 -05:00
Vijay Janapa Reddi
94dcb6c95d fix(release): remove redundant H1 title from generated release notes
GitHub release UI already displays the title, so including it in the
markdown body creates visual redundancy. Updated generator to start
directly with description paragraph followed by Key Highlights section.

All existing releases (v0.1.0 through v0.4.1) have been updated to
follow this cleaner format.
2025-11-02 11:28:40 -05:00
Vijay Janapa Reddi
a0f9e9caec fix(changelog): simplify gh-pages detection to any commit
PROBLEM:
- Generator was searching for specific commit messages ('Built site for gh-pages')
- Workflow changed message format to '🚀 Deploy release from commit...'
- This caused it to miss recent October publishes and look back to August

SOLUTION:
- ANY commit to gh-pages branch = publication
- Removed message filtering entirely
- Now uses: git log -n 1 origin/gh-pages (simple and reliable)

RESULT:
- Correctly finds Oct 20, 2025 as last publish (was finding Aug 6)
- Tracks 150 commits since last publish (not 1,491)
- Works regardless of commit message format changes
2025-11-02 11:19:40 -05:00
Vijay Janapa Reddi
28fbd01560 fix(precommit): replace Python 3.10+ union syntax with Optional
Replace 'str | None' with 'Optional[str]' in validate_citations.py
for compatibility with Python 3.9 and earlier versions used in
pre-commit environments.
2025-11-02 11:15:33 -05:00
Vijay Janapa Reddi
e56563aba4 feat(release): intelligent release notes generator with no fallback text
Completely rewrites release notes generation to parse and use actual changelog data:

BEFORE:
- Returned hardcoded generic text regardless of changelog content
- Had misleading fallback that ignored real changes
- No categorization or analysis

AFTER:
- Parses changelog sections (frontmatter, chapters, labs, appendix)
- Categorizes changes (content, infrastructure, bug fixes)
- Extracts specific items with chapter names and details
- Generates statistics from actual data (61 updates, 29 chapters, etc)
- Fails explicitly if changelog missing (no misleading fallbacks)
- Validates output quality (must be > 100 chars)

Release notes now accurately reflect what actually changed rather than
returning generic marketing text. Critical for proper release documentation.
2025-11-02 11:08:58 -05:00
Vijay Janapa Reddi
be0694dc2e refactor(maintenance): consolidate release notes scripts into unified tool
Addresses script organization and maintainability:
- Merged generate_release_notes.py and release_notes.py into changelog-releasenotes.py
- Removed deprecated change_log.py (superseded by changelog-releasenotes.py)
- Added diagram-*.pdf to .gitignore (Quarto auto-generated cache files)

This consolidation simplifies the release workflow and eliminates duplicate code.
2025-11-02 11:03:07 -05:00
Vijay Janapa Reddi
7738c8cc03 Fixes answer redistribution in MCQs
Corrects answer redistribution logic in multiple-choice questions to properly update all references to the answer options being swapped, avoiding double-swapping issues.

Addresses an issue where answer text wasn't correctly updated when MCQ answer options were redistributed. It ensures references to option letters (A, B, C, D) are updated in both "The correct answer is X" and "Option X" contexts within the answer text.
2025-11-02 10:19:06 -05:00
Vijay Janapa Reddi
53b31cb8b6 chore(test): add TikZ style linter for undefined style detection\n\nScans all Quarto .tikz blocks, collects defined styles, flags uses of undefined custom styles like Line/Box/etc. Heuristics focus on tokens starting uppercase to minimize false positives from colors and built-in keys. Provides file and line context; exits nonzero on findings. 2025-11-01 13:26:05 -04:00
Didier Durand
2249346319 Fixing dangling link in README.md 2025-10-31 07:20:59 +01:00
Vijay Janapa Reddi
5a271b2a3a Adds required dependencies
Adds beautifulsoup4 and requests libraries to the list of
dependencies needed for the genai scripts. These libraries are
required for enhanced functionality in the scripts.
2025-10-25 14:09:37 -04:00
Vijay Janapa Reddi
10efe50b47 Adds self-referential section checker
Implements a script to detect self-referential or circular section
references within Quarto files. This helps identify potential writing
issues where a section refers to itself, its parent, or its child.
2025-10-17 10:22:07 -04:00
Vijay Janapa Reddi
fd87823d4e enhance: improve changelog generation to focus on user-facing changes
- Enhanced AI prompt to filter out internal infrastructure changes
- Focus on educational improvements that benefit readers and instructors
- Skip entries with only section IDs, formatting, or build system changes
- Prioritize content additions, learning enhancements, and clarity improvements
- Updated changelog with user-focused descriptions since August 6th

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 18:18:16 -04:00
Vijay Janapa Reddi
914e4bfb4d fix(citations): add missing bibliography entries and improve validation
Add missing citations to chapter bib files:
- carlini2021extracting to privacy_security.bib
- koomey2011web to frontiers.bib
- quinonero2009dataset to robust_ai.bib

Enhance citation validation script:
- Strip trailing punctuation (.,;:) from citation keys
- Filter out DOI-style citations (e.g., @10.1109/...)
- Prevent false positives from citations like [@key.]

These changes fix all reported citation validation failures while
improving the validation script to handle edge cases better.
2025-10-09 15:01:07 -04:00
Vijay Janapa Reddi
a1498f37cd docs(scripts): add citation validation documentation
Add comprehensive documentation for the new citation validation script
and pre-commit hook, including usage examples, troubleshooting, and
integration details.
2025-10-09 14:48:30 -04:00
Vijay Janapa Reddi
4fe88bf456 feat(pre-commit): add citation validation hook
Add new pre-commit hook to validate that all @key citations in .qmd
files have corresponding entries in their .bib files. This catches
missing bibliography entries before they cause Quarto build failures.

Features:
- Validates citations against bibliography files
- Filters out cross-reference labels (fig-, tbl-, sec-, etc.)
- Provides clear error messages with missing citation keys
- Only checks files being committed (not entire codebase)
- Runs in quiet mode to reduce noise

New script: tools/scripts/content/validate_citations.py
Updated: .pre-commit-config.yaml with validate-citations hook
2025-10-09 14:47:35 -04:00
Vijay Janapa Reddi
26d3ba57bc fix(scripts): correct workspace root path calculation in format_tables.py
Fix path traversal from 3 to 4 parent directories to correctly locate
workspace root when script is at tools/scripts/content/format_tables.py.

This fixes the pre-commit hook error where it was looking for files at
/tools/quarto/contents instead of /quarto/contents.
2025-10-09 13:51:41 -04:00
Vijay Janapa Reddi
3b37726b27 refactor(tools): reorganize scripts directory structure for better maintainability
Consolidated 21 root-level scripts into logical subdirectories:

New structure:
- images/: All image management scripts (10 files consolidated from 3 locations)
- infrastructure/: CI/CD and container scripts (3 files)
- content/: Added formatting scripts (3 files moved from root)
- testing/: All test scripts (5 files consolidated)
- glossary/: Added standardize_glossaries.py
- maintenance/: Added generate_release_notes.py, preflight.py
- utilities/: Added validation scripts

Benefits:
- Reduced root-level clutter (21 → 2 files)
- Related scripts grouped logically
- Easier to find and maintain scripts
- Follows standard project organization patterns

Changes:
- Created new subdirectories: images/, infrastructure/
- Moved scripts from root to appropriate subdirectories
- Consolidated scattered scripts (images were in 3 places)
- Updated all pre-commit hook references
- Created README files for new directories
- Included backup file for rollback if needed

Tool: tools/scripts/reorganize_scripts.py (for future reference)
2025-10-09 13:36:16 -04:00
Vijay Janapa Reddi
2e3930b5d1 feat(tools): add markdown list formatting checker and auto-fixer
Created check_list_formatting.py to enforce proper markdown list formatting:
- Detects bullet lists without preceding blank lines
- Auto-fixes issues with --fix flag
- Supports --check mode for CI/CD validation
- Can process single files or directories recursively
- Comprehensive documentation in README_LIST_FORMATTING.md

This tool ensures markdown renders correctly across all parsers
(Quarto, GitHub, etc.) by requiring empty lines before bullet lists.

Tool location: tools/scripts/utilities/check_list_formatting.py
2025-10-09 13:35:56 -04:00
Vijay Janapa Reddi
52e2ed1f4e Updates AI Engineering definition and references
Updates the AI Engineering definition and corrects a typo.
Updates broken cross-references to deployment paradigms.
Standardizes the format of bibtex entries.
Refactors a table in the robust AI section.
2025-10-08 18:47:44 -04:00
Vijay Janapa Reddi
54a8b5a572 feat(content): add Netlify badge to main page
- Add fixed position Netlify badge to bottom-right of HTML version
- Badge is small (30px), clickable, and links to netlify.com
- Only visible in HTML format, not PDF/EPUB
- Addresses Netlify hosting requirement for visible badge on main page
2025-10-08 08:35:48 -04:00
Vijay Janapa Reddi
e97f587776 refactor(tables): apply improved table formatting across core chapters
- Updated format_tables.py with enhanced formatting logic
- Applied consistent table formatting to 12 core chapters:
  - ai_for_good, benchmarking, data_engineering
  - dnn_architectures, frameworks, hw_acceleration
  - ml_systems, optimizations, privacy_security
  - responsible_ai, robust_ai, sustainable_ai
- Fixed table alignment in labs/kits.qmd
- Ensures uniform table styling throughout the book
2025-10-07 23:52:22 -04:00
Vijay Janapa Reddi
1eec01e680 Add auto-alignment to table formatter + format all tables
Formatter enhancements:
- Auto-detect column content types (text vs numeric)
- Left-align text columns by default
- Right-align numeric columns (>70% numeric content)
- Handles units (W, mW, KB, MB, etc.) in numeric detection
- Improves readability following textbook standards

Table formatting applied:
- All 114 tables formatted with proper alignment
- Headers bolded consistently
- First columns intelligently bolded
- Multiline headers supported
- Column widths correctly calculated

Result: Professional, consistent table formatting throughout
the book following academic publishing best practices.
2025-10-07 14:02:23 -04:00
Vijay Janapa Reddi
64931159dc Add multiline header support to table formatter
- Parse multiple header rows (lines before separator)
- Format all header rows with bold markers
- Calculate widths across all header rows
- Validate all header rows for bolding
- Fixes formatting for 6 tables with multiline headers
- Update documentation to reflect multiline support
2025-10-07 13:53:12 -04:00
Vijay Janapa Reddi
a4065670fd fix: standardize conclusion learning objectives and clean Purpose sections
- Move conclusion chapter learning objectives to callout format matching other chapters
- Position learning objectives before Overview section for consistency
- Remove footnotes from workflow chapter Purpose section to keep it clean
- Update footnote agent guidelines to never add footnotes to Purpose sections

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 09:49:29 -04:00
Vijay Janapa Reddi
417c4849f3 docs: add table formatter documentation and update dependencies
- Added comprehensive README for table formatter tool
- Updated tools dependencies
- Cleaned up development requirements
- Removed outdated footnote context
2025-10-06 14:12:21 -04:00
Vijay Janapa Reddi
c4755bfc82 chore: update section IDs and add table formatting utilities
Section ID Updates:
- Updated section identifiers across multiple chapters for consistency
- Modified section references in conclusion, introduction, ai_for_good, efficient_ai, hw_acceleration, benchmarking, and ml_systems chapters
- Fixed broken Bitter Lesson reference in efficient_ai chapter

Quiz Updates:
- Updated quiz section references in emerging_topics_quizzes.json, frontiers_quizzes.json, and ml_systems_quizzes.json to match new section IDs

New Utilities:
- Added format_tables.py: Python utility for formatting Quarto markdown tables
- Added test_format_tables.py: Test suite for table formatting utility

These changes maintain cross-reference consistency after recent chapter reorganization.
2025-10-06 13:04:07 -04:00
Vijay Janapa Reddi
0ad1dba150 Incorporate expert feedback and apply formatting fixes across all chapters
- Enhanced content based on comprehensive expert review feedback
- Added quantitative examples, visual elements, and decision frameworks
- Fixed formatting consistency (removed bold paragraph starters, improved text flow)
- Restored missing sections (Fallacies & Pitfalls where needed)
- Improved cross-references and section organization
- Fixed broken section references and removed missing image references

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 11:28:17 -04:00
Vijay Janapa Reddi
a48cbaa6b9 Fix chapter numbering in changelog
- Add Frontiers as Chapter 20 (was missing from lookup table)
- Update Conclusion from Chapter 20 to Chapter 21
- Remove Emerging Topics entries (chapter no longer exists)
- Update script's chapter_lookup table for future changelog runs
2025-10-05 12:45:19 -04:00
Vijay Janapa Reddi
ee453794e0 Fix changelog script bugs and generate AI-powered changelog
Script fixes:
- Fix year header detection to handle both '## 2025' and '## 2025 Updates' formats
- Fix labs organization to work with AI-generated summaries
- Add AI artifact cleanup to remove 'Let me know...' phrases
- Improve lab grouping logic for AI mode

Changelog updates:
- Generate comprehensive changelog with AI summaries for all changes since Aug 6
- 61 files updated: 6 frontmatter, 29 chapters, 26 labs
- Clean, professional AI-generated descriptions without artifacts
2025-10-05 12:37:07 -04:00
Vijay Janapa Reddi
8e8277face Fix critical path bugs in changelog scripts and workflows
- Update changelog scripts to use correct 'quarto/contents/**/*.qmd' path
- Fix quarto config paths from 'book/config/' to 'quarto/config/'
- Update link-check workflow with correct content paths
- Resolves issue where scripts found 0 changes instead of 330+ commits
2025-10-05 12:26:17 -04:00
Vijay Janapa Reddi
9df531dd4e Enable full book PDF build and add Python formatting utility
- Uncomment all chapters in PDF config for complete book builds
- Add format_python_in_qmd.py script for code formatting
- Remove temporary working files (notes, footnote catalog)
- Update changelog (no new content changes since last publish)
2025-10-05 12:19:19 -04:00
Vijay Janapa Reddi
2d73027a79 Update content and configuration files
- Update multiple core content chapters (qmd files)
- Update quiz files across multiple chapters
- Update Quarto configuration files (epub, html, pdf)
- Update CLI commands and main module
- Update robust_ai content
- Add comprehensive notes for v0.4.1
- Update lab content for Arduino Nicla Vision
- Update part summaries and scripts
- Fix duplicate labels and section references
- Fix footnote issues
- Clean up duplicate section IDs in frontiers.qmd
- Add references to unreferenced figures and tables
2025-10-05 11:59:39 -04:00
Vijay Janapa Reddi
1da8bb80ff Fix quarto render command syntax to use --to=format
- Updated CLI build commands to use proper --to=format syntax instead of --to format
- Fixed in build_full(), build_chapters(), and build_html_only() methods
- Updated BUILD.md documentation to reflect correct syntax
- Updated manage_captions.py error message with correct syntax

This ensures compatibility with quarto's expected command-line argument format.
2025-10-02 18:54:06 -04:00
Vijay Janapa Reddi
096b338031 Adds script to remove mid-paragraph bold
Adds a script to automatically find and remove bold formatting that appears in the middle of paragraphs within .qmd files.

The script skips footnotes, captions, and lines starting with bold text to avoid unintended modifications. It performs a dry run first to display potential changes before applying them.
2025-10-02 18:50:35 -04:00