mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-06-02 01:10:53 -05:00
- Replace manual testing with pytest test classes and assertions - Add comprehensive test coverage: - Function execution without errors - Correct output content validation - ASCII art file existence and content checks - Error handling and fallback behavior - Missing file graceful handling - Update README with pytest testing instructions - Make testing consistent with other TinyTorch modules - All 5 tests passing with proper pytest integration
Setup Module
Welcome to TinyTorch! This is your first module in the Machine Learning Systems course.
Overview
The setup module is a simple introduction to TinyTorch that displays beautiful ASCII art to get you started on your ML systems journey.
Files
setup_dev.py- Main development file with the hello_tinytorch() functionsetup_dev.ipynb- Jupyter notebook version (auto-generated)tinytorch_flame.txt- ASCII art file containing the TinyTorch flame designtests/test_setup.py- pytest test suite for the moduleREADME.md- This file
Usage
Python Script
from setup_dev import hello_tinytorch
hello_tinytorch()
Jupyter Notebook
Open setup_dev.ipynb and run the cells to see the ASCII art displayed.
Testing
Run the tests using pytest:
# Using the TinyTorch CLI (recommended)
python bin/tito.py test --module setup
# Or directly with pytest
python -m pytest modules/setup/tests/test_setup.py -v
Test Coverage
The test suite includes:
- ✅ Function execution without errors
- ✅ Correct output content (ASCII art and branding)
- ✅ ASCII art file existence and content validation
- ✅ Graceful handling of missing files
- ✅ Error recovery and fallback behavior
ASCII Art Customization
The ASCII art is loaded from tinytorch_flame.txt. You can customize it by:
- Edit the file directly: Modify
tinytorch_flame.txtwith your own ASCII art - Create your own design: Replace the flame with your initials, logo, or any design you like
What You'll Learn
This simple module introduces:
- Basic Python file structure
- File I/O operations
- Error handling (fallback when file not found)
- pytest testing framework and best practices
- The TinyTorch development workflow
Next Steps
Once you've explored this module, you're ready to move on to the tensor module where you'll build the core data structures for TinyTorch!