mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-05-08 21:47:31 -05:00
BREAKTHROUGH IMPLEMENTATION: ✅ Auto-generated warnings now added to ALL exported files automatically ✅ Clear source file paths shown in every tinytorch/ file header ✅ CLAUDE.md updated with crystal clear rules: tinytorch/ = edit modules/ ✅ Export process now runs warnings BEFORE success message SYSTEMATIC PREVENTION: - Every exported file shows: AUTOGENERATED! DO NOT EDIT! File to edit: [source] - THIS FILE IS AUTO-GENERATED FROM SOURCE MODULES - CHANGES WILL BE LOST! - To modify this code, edit the source file listed above and run: tito module complete WORKFLOW ENFORCEMENT: - Golden rule established: If file path contains tinytorch/, DON'T EDIT IT DIRECTLY - Automatic detection of 16 module mappings from tinytorch/ back to modules/source/ - Post-export processing ensures no exported file lacks protection warning VALIDATION: ✅ Tested with multiple module exports - warnings added correctly ✅ All tinytorch/core/ files now protected with clear instructions ✅ Source file paths correctly mapped and displayed This prevents ALL future source/compiled mismatch issues systematically.
TinyTorch Examples 🔥
Real-world examples showing what you can build with TinyTorch!
What Are These Examples?
These are real ML applications written using TinyTorch just like you would use PyTorch. Each example:
- Uses
import tinytorchas a real package - Shows professional ML code patterns
- Demonstrates actual capabilities you've built
- Can be run by anyone to see TinyTorch in action
Running Examples
# After installing/building TinyTorch:
cd examples/xor_network/
python train.py
# Or for image recognition:
cd examples/mnist_recognition/
python train_mnist.py
Example Categories
🧠 Neural Network Fundamentals
xor_network/- Classic XOR problem with hidden layerslinear_regression/- Simple regression tasks
👁️ Computer Vision
mnist_recognition/- Handwritten digit recognitioncifar10_classifier/- Real-world object classificationimage_filters/- Convolutional feature extraction
🤖 Language & Generation
text_generation/- Generate text with TinyGPTcode_completion/- Python code generation
⚡ Advanced Topics
autograd_demo/- Automatic differentiationoptimization_comparison/- SGD vs Adammodel_compression/- Quantization and pruningperformance_profiling/- Benchmarking tools
Example Structure
Each example directory contains:
example_name/
├── train.py # Main training script
├── model.py # Model architecture (if complex)
├── README.md # What this example demonstrates
├── requirements.txt # Just needs: tinytorch
└── config.yml # Metadata about the example
For Students
After completing each module, the corresponding example will work:
- Module 05 →
xor_network/works - Module 08 →
mnist_recognition/works - Module 11 →
cifar10_classifier/works with training - Module 16 →
text_generation/works
For Everyone Else
Want to see what TinyTorch can do? Just run any example:
# See a neural network learn XOR:
python examples/xor_network/train.py
# Train a CNN on real images:
python examples/cifar10_classifier/train.py
# Generate text with a transformer:
python examples/text_generation/generate.py
These aren't toy demos - they're real ML applications using a framework built from scratch!