Commit Graph

6 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
f48b0cebe4 Add Module 14-15 connection section to profiling documentation
Explains how profiling enables optimization discovery and connects to KV caching workflow
2025-11-06 15:31:48 -05:00
Vijay Janapa Reddi
9a5b7ad05b Module 15: Export ProfilerComplete and create KV cache profiling demo
- Added ProfilerComplete class to profiling_dev.py with all measurement methods
- Exported ProfilerComplete to tinytorch/profiling/profiler.py
- Created profile_kv_cache.py milestone demonstrating scientific performance measurement
- Demo shows 19x speedup from KV caching with detailed profiling metrics
- Validates Module 14 KV cache optimization impact quantitatively
2025-11-06 14:21:22 -05:00
Vijay Janapa Reddi
0e997e4a10 refactor: Standardize imports across modules 10-17 to match 01-09
Enforce consistent import pattern across all modules:
- Direct imports from tinytorch.core.* (no fallbacks)
- Remove all sys.path.append manipulations
- Remove try/except import fallbacks
- Remove mock/dummy class fallbacks

Fixed modules:
- Module 10 (tokenization): Removed try/except fallback
- Module 12 (attention): Removed sys.path.append for tensor/layers
- Module 15 (profiling): Removed sys.path + mock Tensor/Linear/Conv2d
- Module 16 (acceleration): Removed hardcoded path + importlib + mock Tensor
- Module 17 (quantization): Removed sys.path + disabled fallback block

All modules now follow the same pattern as modules 01-09:
  from tinytorch.core.tensor import Tensor
  from tinytorch.core.layers import Linear
  # etc.

No development fallbacks - assume tinytorch package is installed.
2025-10-24 17:51:10 -04:00
Vijay Janapa Reddi
8be87d0add Fix nbdev export system across all 20 modules
PROBLEM:
- nbdev requires #| export directive on EACH cell to export when using # %% markers
- Cell markers inside class definitions split classes across multiple cells
- Only partial classes were being exported to tinytorch package
- Missing matmul, arithmetic operations, and activation classes in exports

SOLUTION:
1. Removed # %% cell markers INSIDE class definitions (kept classes as single units)
2. Added #| export to imports cell at top of each module
3. Added #| export before each exportable class definition in all 20 modules
4. Added __call__ method to Sigmoid for functional usage
5. Fixed numpy import (moved to module level from __init__)

MODULES FIXED:
- 01_tensor: Tensor class with all operations (matmul, arithmetic, shape ops)
- 02_activations: Sigmoid, ReLU, Tanh, GELU, Softmax classes
- 03_layers: Linear, Dropout classes
- 04_losses: MSELoss, CrossEntropyLoss, BinaryCrossEntropyLoss classes
- 05_autograd: Function, AddBackward, MulBackward, MatmulBackward, SumBackward
- 06_optimizers: Optimizer, SGD, Adam, AdamW classes
- 07_training: CosineSchedule, Trainer classes
- 08_dataloader: Dataset, TensorDataset, DataLoader classes
- 09_spatial: Conv2d, MaxPool2d, AvgPool2d, SimpleCNN classes
- 10-20: All exportable classes in remaining modules

TESTING:
- Test functions use 'if __name__ == "__main__"' guards
- Tests run in notebooks but NOT on import
- Rosenblatt Perceptron milestone working perfectly

RESULT:
 All 20 modules export correctly
 Perceptron (1957) milestone functional
 Clean separation: development (modules/source) vs package (tinytorch)
2025-09-30 11:21:04 -04:00
Vijay Janapa Reddi
9cfc7673cf feat: update advanced modules (09-20) with latest improvements
- Update spatial, tokenization, embeddings, attention modules
- Update transformers, kv-caching, profiling modules
- Update acceleration, quantization, compression modules
- Update benchmarking and capstone modules
- Align with current TinyTorch standards and patterns
2025-09-30 09:45:00 -04:00
Vijay Janapa Reddi
e1a9541c4b Clean up module imports: convert tinytorch.core to sys.path style
- Remove circular imports where modules imported from themselves
- Convert tinytorch.core imports to sys.path relative imports
- Only import dependencies that are actually used in each module
- Preserve documentation imports in markdown cells
- Use consistent relative path pattern across all modules
- Remove hardcoded absolute paths in favor of relative imports

Affected modules: 02_activations, 03_layers, 04_losses, 06_optimizers,
07_training, 09_spatial, 12_attention, 17_quantization
2025-09-30 08:58:58 -04:00