mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-05-08 23:52:32 -05:00
- Fix XOR example to properly use Variables for trainable parameters
- Convert layer weights and biases to Variables with requires_grad=True
- Handle Variable data extraction for evaluation and display
- Demonstrate successful training: 50% → 100% accuracy, loss 0.25 → 0.003
MILESTONE ACHIEVED:
🎉 First complete neural network training working in TinyTorch!
- XOR problem solved with 100% accuracy over 500 epochs
- Proves autograd integration successful across layers and losses
- Validates that TinyTorch can train real neural networks end-to-end
- Establishes foundation for more complex training examples
This proves the framework integration works and TinyTorch can be used
like PyTorch for real machine learning tasks.
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!