2580 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
e11195c377 Fix test issues: remove misplaced file and fix learning rate
- Removed tests/08_dataloader/test_autograd_core.py (duplicate of 05_autograd)
- Fixed learning rate in training test to prevent gradient explosion
2025-12-02 23:08:23 -08:00
Vijay Janapa Reddi
4aa444517b Extend integration test mapping to cover all 20 modules
Added explicit comments explaining which tests apply to each tier:
- Foundation (01-07): Core integration tests
- Architecture (08-13): CNN and NLP pipeline tests
- Performance (14-19): Module-specific tests only
- Capstone (20): Comprehensive validation
2025-12-02 23:07:04 -08:00
Vijay Janapa Reddi
47635d1550 Add three-phase testing to tito module test
- Phase 1: Inline unit tests (quick sanity checks)
- Phase 2: Module pytest with --tinytorch educational output
- Phase 3: Integration tests for modules 01-N

Added --unit-only and --no-integration flags for flexibility.
Students can now run comprehensive tests with clear feedback
about what each phase is checking and why it matters.
2025-12-02 23:06:17 -08:00
Vijay Janapa Reddi
c479b93005 Add testing section to student workflow documentation
Documents educational test mode with --tinytorch flag and explains
WHAT/WHY/learning tips that tests provide
2025-12-02 22:55:22 -08:00
Vijay Janapa Reddi
caad227ef8 Add tito module list command to README
Documents the new module list command for discovering available modules
2025-12-02 22:54:23 -08:00
Vijay Janapa Reddi
e103f0dff7 Document educational test mode in tests/README.md
- Add --tinytorch flag documentation for Rich educational output
- Document WHAT/WHY/STUDENT LEARNING docstring format
- Show example of the docstring structure
2025-12-02 22:53:30 -08:00
Vijay Janapa Reddi
73a229faa3 Add tito module list command for students to see all modules
New command shows all 21 modules with descriptions:
- tito module list - Shows numbered table of all modules
- Educational descriptions explain what each module covers
- Links to start and status commands for next steps
2025-12-02 22:50:43 -08:00
Vijay Janapa Reddi
8d77ea3cd1 Add educational WHAT/WHY/STUDENT LEARNING docstrings to all module tests
All 20 modules now have *_core.py test files with:
- Module-level context explaining WHY the component matters
- WHAT each test does
- WHY that behavior is important
- STUDENT LEARNING tips for understanding

Works with --tinytorch pytest flag for Rich CLI output.
2025-12-02 22:47:25 -08:00
Vijay Janapa Reddi
36dd05ef62 Add educational test output with Rich CLI
- Create pytest_tinytorch.py plugin for educational test output
- Update test_tensor_core.py with WHAT/WHY/STUDENT LEARNING docstrings
- Show test purpose on pass, detailed context on failure
- Use --tinytorch flag to enable educational mode

Students can now understand what each test checks and why it matters.
2025-12-02 22:37:25 -08:00
Vijay Janapa Reddi
a622e2c200 Fix regression tests for current API
- Update TransformerBlock to use mlp_ratio instead of hidden_dim
- Update PositionalEncoding argument order
- Fix MultiHeadAttention to use self-attention API
- Add missing MultiHeadAttention import
2025-12-02 22:30:42 -08:00
Vijay Janapa Reddi
1e155fb4da Remove legacy broken tests with outdated API imports
- tests/performance/: Referenced non-existent modules/ directory
- tests/system/: Required tinytorch.nn.functional which does not exist
- tests/regression/test_conv_linear_dimensions.py: Same issue
- These tests predated the API consolidation
2025-12-02 22:30:37 -08:00
Vijay Janapa Reddi
df6247d0eb Add core tests for modules 06, 12, and 14-20
- Module 06: 7 tests for SGD/Adam optimizer weight updates
- Module 12: 9 tests for attention computation and gradient flow
- Modules 14-20: Educational tests with skip for unexported modules
- All tests include docstrings explaining WHAT, WHY, and HOW
2025-12-02 22:30:29 -08:00
Vijay Janapa Reddi
23d4aa310e Fix division by zero in milestone status when no milestones exist 2025-12-02 22:09:51 -08:00
Vijay Janapa Reddi
7d41bb125e Clean up naming conventions
- Remove top-level SimpleModel from modules 15 & 16 (keep in test functions)
- Rename QuantizationComplete → Quantizer (cleaner, matches Profiler pattern)
- Rename CompressionComplete → Compressor (same pattern)
- Rename benchmarking.benchmark → bench (shorter)
2025-12-02 22:05:50 -08:00
Vijay Janapa Reddi
ed4791f79f Rename optimization → perf for cleaner package structure
tinytorch.perf.* for performance tier (14-18):
- profiling, quantization, compression, memoization, acceleration

Avoids confusion with tinytorch.core.optimizers (SGD, Adam)
2025-12-02 23:17:29 -05:00
Vijay Janapa Reddi
4c190edb2e Reorganize package: consolidate exports to core/ and optimization/
Export changes:
- 08: data.loader → core.dataloader
- 10: text.tokenization → core.tokenization
- 11: text.embeddings → core.embeddings
- 13: models.transformer → core.transformer
- 14: profiling.profiler → optimization.profiling
- 17: generation.kv_cache → optimization.memoization

Run tito module complete on 08,10,11,13,14,17 to regenerate
2025-12-02 22:59:22 -05:00
Vijay Janapa Reddi
1c1921bfba Fix CLI help test for custom help format 2025-12-02 22:26:37 -05:00
Vijay Janapa Reddi
ea0dee1cc9 Update CLI registry test for current command structure
- Added login.py as expected subcommand file
- Removed references to deleted archived commands (leaderboard, olympics, etc.)
2025-12-02 22:25:18 -05:00
Vijay Janapa Reddi
c4f6454ee5 Remove legacy integration tests with outdated APIs
Removed tests that used old APIs (Variable, learning_rate, etc.):
- test_optimizers_integration.py
- test_module_dependencies.py
- integration_simple_test.py
- integration_xor_test.py

These are replaced by the new comprehensive tests:
- test_training_flow.py (8 tests)
- test_gradient_flow.py (6 tests)
- test_nlp_pipeline_flow.py (8 tests)
- test_cnn_integration.py (10 tests)

All 67 integration tests now pass.
2025-12-02 22:23:54 -05:00
Vijay Janapa Reddi
6546b56c23 Fix gradient flow tests - use tensor operations for loss
The tests were creating losses incorrectly by breaking the computation graph:
  WRONG: loss = Tensor(np.sum(output.data))  # Breaks graph!
  RIGHT: loss = output.sum()  # Maintains graph

Fixed:
- test_cnn_integration.py: Conv2d and CNN gradient tests
- test_nlp_pipeline_flow.py: Attention gradient tests
- Removed xfail marker from attention test (now passing)

The underlying Conv2d and Attention implementations were correct all along.
2025-12-02 22:22:51 -05:00
Vijay Janapa Reddi
d9633041e1 Fix test imports and nn module exports
- Fix nn/__init__.py: alias Layer as Module for PyTorch compatibility
- Fix test_layers_integration.py: use package imports instead of sys.exit
- Fix test_optimizers_integration.py: use package imports instead of exec()
- Add ReLU, Sigmoid, Softmax, Tanh exports to nn module
2025-12-02 22:18:42 -05:00
Vijay Janapa Reddi
fb20e255c9 Add integration tests for training flow and NLP pipeline
New tests that catch module boundary bugs:

test_training_flow.py:
- Optimizer actually updates weights (SGD, Adam)
- Training reduces loss over iterations
- Gradient chain not broken through 5 layers
- Input receives gradients
- zero_grad works correctly
- Batch gradients are averaged

test_nlp_pipeline_flow.py:
- Embedding receives gradients
- Repeated tokens accumulate gradients
- Attention projections receive gradients
- Attention input receives gradients (xfail - known issue)
- Transformer block gradient flow
- Complete NLP pipeline end-to-end

README.md:
- Integration test philosophy
- Good vs bad integration test examples
- Coverage gaps and how to fill them
2025-12-02 22:14:08 -05:00
Vijay Janapa Reddi
3a885601f9 Clean up repository
- Remove stale feature branches (kept debugging branch with unmerged work)
- Move test_spatial_core.py to correct directory (tests/09_spatial)
- Remove .tito user state from tracking (config.json, progress.json)
- Delete archived CLI commands (tito/commands/_archived/)
- Move standalone integration tests to tests/integration/
- Remove outdated audit/report markdown files
- Remove old template and deprecated test files
- Simplify .gitignore for .tito/ directory
2025-12-02 22:03:16 -05:00
Vijay Janapa Reddi
ca9922224a Add verbose mode and debug logging to preflight command
- Add --verbose flag to show commands as they execute
- Capture stdout/stderr for each check
- Save debug log to .tito/logs/preflight_TIMESTAMP.log
- Show failure details with command and output on failures
- Log file location shown when checks fail
2025-12-02 21:51:42 -05:00
Vijay Janapa Reddi
c23cc5d41b Add CI and docs workflow status badges to README 2025-12-02 21:33:12 -05:00
Vijay Janapa Reddi
850b27a901 Remove scripts/preflight.sh in favor of tito dev preflight command 2025-12-02 21:32:09 -05:00
Vijay Janapa Reddi
fc6f070dfc Add smart sticky bar with under construction badge
- Shows 🚧 Under Construction badge next to brand
- Bar hides on scroll down, reappears on scroll up
- Always visible at top of page
- Badge hidden on mobile to save space
2025-12-02 21:26:13 -05:00
Vijay Janapa Reddi
af0beb9408 Simplify top bar to match MLSysBook style
- Clean navigation bar: brand left, links right
- Icon+text buttons: MLSysBook, Subscribe, Star, Community
- Responsive: icons only on mobile
- Removed old WIP banner complexity
2025-12-02 21:24:22 -05:00
Vijay Janapa Reddi
2c5ef2e3cf Fix tagline consistency: Don't import it. Build it.
- Remove 'just' from all instances of the tagline
- Update banner to lead with tagline
- Consistent branding across docs, CLI, and demos
2025-12-02 21:17:41 -05:00
Vijay Janapa Reddi
660ba60d0f Transform WIP banner into TinyTorch announcement bar
- Change from yellow 'Under Construction' to blue professional banner
- Add MLSysBook link, Community join CTA, GitHub link
- Remove duplicate header from intro.md (banner is on all pages now)
- Consistent branding across every page
2025-12-02 21:01:05 -05:00
Vijay Janapa Reddi
6a99354213 Fix Binder setup to generate notebooks at build time
- Add jupytext dependency to binder/requirements.txt
- Update postBuild to convert src/*.py files to modules/*.ipynb
- Document the notebook generation workflow in README.md

This ensures Binder users get ready-to-use notebooks that are
always in sync with the source Python files.
2025-12-02 20:51:18 -05:00
Vijay Janapa Reddi
354540b855 Add header bar and community section to landing page
- Top bar: TinyTorch branding + MLSysBook link + GitHub
- Community section: Join the map CTA
- Footer: Links to MLSysBook, GitHub, Leaderboard
2025-12-02 19:55:51 -05:00
Vijay Janapa Reddi
d9b6366c50 Simplify community URLs - remove /community/ prefix 2025-12-02 19:23:58 -05:00
Vijay Janapa Reddi
e315e5648c Remove VerifyCommand from exports 2025-12-02 19:23:15 -05:00
Vijay Janapa Reddi
11615a2288 Integrate verification and community registration into setup command
- Remove standalone verify command (redundant with system health)
- Add community map registration prompt at end of setup
- Setup now includes: venv, packages, profile, validation, community prompt
- Simplifies student journey: one command to get started
2025-12-02 18:42:51 -05:00
Vijay Janapa Reddi
00019408b0 Add tito verify command and expand package exports
- Add tito verify command for setup validation and community registration
- Fix broken Dense import in tinytorch/__init__.py (class does not exist)
- Clean up layers.py __all__ to remove non-existent Dense and internal constants
- Add commonly used components to top-level exports:
  - AvgPool2d, BatchNorm2d (spatial operations)
  - RandomHorizontalFlip, RandomCrop, Compose (data augmentation)
- Total exports now 41 (was 35)
2025-12-02 15:56:32 -05:00
Vijay Janapa Reddi
2b0a1db71e Fix all tests to pass: clean up stale and misaligned test files
Test cleanup:
- Remove misaligned progressive integration tests (wrong module assignments)
- Remove tests referencing non-existent classes (SimpleDataset, etc.)
- Remove tests with wrong API signatures (learning_rate vs lr, etc.)
- Fix parameter names: use_bias -> bias, weights -> weight
- Fix dtype tests: expect float32 (TinyTorch standard)
- Add MultiplyLayer definition where missing

Results:
- tito module test --all: 20/20 modules pass
- pytest tests/modules: 223 tests pass

Both inline tests and external tests now pass completely.
2025-12-02 14:30:31 -05:00
Vijay Janapa Reddi
bd7fcb2177 Release preparation: fix package exports, tests, and documentation
Package exports:
- Fix tinytorch/__init__.py to export all required components for milestones
- Add Dense as alias for Linear for compatibility
- Add loss functions (MSELoss, CrossEntropyLoss, BinaryCrossEntropyLoss)
- Export spatial operations, data loaders, and transformer components

Test infrastructure:
- Create tests/conftest.py to handle path setup
- Create tests/test_utils.py with shared test utilities
- Rename test_progressive_integration.py files to include module number
- Fix syntax errors in test files (spaces in class names)
- Remove stale test file referencing non-existent modules

Documentation:
- Update README.md with correct milestone file names
- Fix milestone requirements to match actual module dependencies

Export system:
- Run tito export --all to regenerate package from source modules
- Ensure all 20 modules are properly exported
2025-12-02 14:19:56 -05:00
Vijay Janapa Reddi
4b22d229d4 Update documentation to reflect current CLI and December 2025 state
Changes to README.md:
- Update Quick Start section to use `tito setup` instead of setup-environment.sh
- Change activation command to `source .venv/bin/activate`
- Update system check command from `tito system health` to `tito system doctor`
- Update module commands to use numbers (tito module start 01) instead of full names
- Update milestone/checkpoint commands to current CLI interface
- Change release banner to "December 2025 Pre-Release" with CLI focus
- Add user profile creation to setup features list

Changes to module ABOUT.md files:
- Update activation command from `source scripts/activate-tinytorch` to `source .venv/bin/activate`
- Update system check from `tito system health` to `tito system doctor`

Binder configuration verified:
- requirements.txt includes all necessary dependencies (numpy, rich, PyYAML, jupyter, matplotlib)
- postBuild script correctly installs TinyTorch package
- All deployment environments documented

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 12:33:03 -05:00
Vijay Janapa Reddi
d186e5ba17 Simplify .tinytorch structure and add file update notifications
Changes:
- Move profile.json from nested community/ to flat ~/.tinytorch/profile.json
- Add file update notifications when .tinytorch files are created/updated
- Print "📝 Updated: ~/.tinytorch/filename" for better visibility
- Update benchmark.py to use new flat structure
- Update auth.py to print when credentials are saved

Benefits:
- Simpler, flatter directory structure (no unnecessary nesting)
- Users see exactly which files are being modified during setup
- Consistent location for all user data (~/.tinytorch/)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 12:13:46 -05:00
Vijay Janapa Reddi
aae2ac16bf Fix setup command venv recreation logic
When user declined venv recreation, setup was still printing
"Setting up virtual environment..." before checking if it existed,
making it appear that recreation was proceeding anyway.

Changes:
- Check for existing venv before printing any messages
- Show " Using existing virtual environment" when user declines
- Show "🐍 Recreating..." only when actually recreating
- Show "🐍 Setting up..." only for new venv creation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 12:11:19 -05:00
Vijay Janapa Reddi
244ac44a3e Add Rich-formatted help output for tito --help
Replace plain argparse help with custom Rich-formatted output:
- Intercept --help flag before argparse processes it
- Show ASCII logo at top (consistent with tito alone)
- Display commands in beautiful Rich table with colors
- Reuse _generate_welcome_text() for consistency
- Add formatted global options section

Benefits:
- Consistent Rich formatting across tito and tito --help
- Professional table layout for commands (green names, dim descriptions)
- Color-coded sections (cyan headers, yellow options, green commands)
- Same visual experience whether you run tito or tito --help
- All command info dynamically pulled from self.commands dict

Before: Plain black-and-white argparse output
After: Colorful, formatted Rich output with ASCII logo and tables
2025-12-01 08:23:29 -05:00
Vijay Janapa Reddi
3a297fdf64 Make CLI help text dynamically generated from single source of truth
Replace static hardcoded help text with dynamic generation from command registry:
- Create welcome_sections dict as single source of truth for examples
- Add _generate_welcome_text() for interactive mode (tito)
- Add _generate_epilog() for help mode (tito --help)
- Both screens now pull from same data structure

Benefits:
- No more forgetting to update help when commands change
- Student/Developer command lists auto-generated from self.commands dict
- Quick Start examples defined once, used in both places
- Ensures consistency between tito and tito --help outputs

Changes:
- tito/main.py: Replace 40+ lines of static text with 70 lines of dynamic generation
- Commands automatically categorized from student_commands/developer_commands lists
- Rich formatting maintained for interactive mode, stripped for plain --help
2025-12-01 08:13:00 -05:00
Vijay Janapa Reddi
033fa148ff Apply consistent Rich formatting across all CLI commands
Standardize color usage to match TinyTorch CLI style guide:
- Replace [blue] with [cyan] for all action/info messages (10 instances)
- Replace [bold blue] with [bold cyan] for headers (1 instance)
- Replace "bold blue" with "bold cyan" for table headers (3 instances)
- Replace "bright_blue" with "bright_cyan" for panel borders (1 instance)

Files updated:
- tito/main.py: Welcome screen community commands now use [cyan]
- tito/commands/login.py: URL display now uses [cyan]
- tito/commands/protect.py: All 7 blue instances → cyan
- tito/commands/milestone.py: Table headers → bold cyan
- tito/commands/test.py: Table headers → bold cyan
- tito/commands/grade.py: Border style → bright_cyan

Result: Holistic CLI consistency with [cyan] for actions, [green] for success,
[yellow] for warnings, [red] for errors across all 15+ commands.
2025-12-01 07:57:05 -05:00
Vijay Janapa Reddi
7d3e302672 Refactor community command: consolidate login/logout under community namespace
- Move login/logout from standalone commands to tito community subcommands
- Reduce community.py from 860 to 264 lines by removing placeholder profile code
- Delegate login/logout to existing LoginCommand/LogoutCommand (no auth code changes)
- Maintain leaderboard, compete, and submit functionality
- Apply consistent Rich formatting:  emoji, [cyan] for actions, [green] for success
- Update main.py help text to show new command structure

Commands:
  tito community login       - OAuth login via browser
  tito community logout      - Clear credentials
  tito community leaderboard - Open leaderboard
  tito community compete     - Open competitions
  tito community submit      - Validate/submit benchmarks

All auth/submission code unchanged. Style consistent with TinyTorch CLI conventions.
2025-12-01 07:53:43 -05:00
Vijay Janapa Reddi
c3e37567de Merge remote-tracking branch 'origin/dev' into dev 2025-12-01 06:57:51 -05:00
Kai Kleinbard
277033d2f9 Merge pull request #16 from MLSysBook/feat/submission-login-flow-v2
updates to submission to server database and login flow
2025-11-30 21:05:32 -05:00
kai
c682ec2ee3 updates to submission to server database and login flow 2025-11-30 21:01:57 -05:00
Vijay Janapa Reddi
a0468aad18 Update paper URLs: prioritize mlsysbook.ai/tinytorch as primary domain
Changed all three URL references in paper.tex:
- Title page: mlsysbook.ai/tinytorch (was tinytorch.ai)
- Abstract: mlsysbook.ai/tinytorch (was tinytorch.ai)
- Conclusion: mlsysbook.ai/tinytorch (or tinytorch.ai)

This emphasizes the ML Systems Book ecosystem connection in academic
context while maintaining tinytorch.ai as alternate URL. The ecosystem
domain is more stable and institutional for paper citations.
2025-11-30 17:05:01 -05:00
Vijay Janapa Reddi
bd5622c129 Remove operational details from paper: focus on pedagogical value
Cleaned up Module 20 Capstone and MLPerf milestone descriptions:
- Removed CLI command examples (BenchmarkReport, generate_submission, tito community submit)
- Removed detailed infrastructure implementation
- Focused on learning outcomes and systems thinking pedagogy
- Maintained academic tone throughout

These changes complete the paper cleanup for release.
2025-11-30 16:30:27 -05:00