mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-05-31 23:08:14 -05:00
refactor: Implement YAML-based difficulty and time system
- Added educational metadata (difficulty, time_estimate) to all module.yaml files - Updated convert_readmes.py to read from YAML instead of hardcoded mappings - Standardized difficulty progression: ⭐ → ⭐⭐ → ⭐⭐⭐ → ⭐⭐⭐⭐ → ⭐⭐⭐⭐⭐🥷 - Fixed path resolution for YAML reading in book build process - Eliminated duplication: single source of truth for educational metadata - Capstone gets special ninja treatment (⭐⭐⭐⭐⭐🥷) as beyond-expert level
This commit is contained in:
@@ -172,46 +172,18 @@ Ready for serious development? → [🏗️ Local Setup Guide](../usage-paths/se
|
||||
return '\n'.join(enhanced_lines)
|
||||
|
||||
def get_difficulty_stars(module_name: str) -> str:
|
||||
"""Get difficulty stars based on module name."""
|
||||
difficulty_map = {
|
||||
'01_setup': '⭐',
|
||||
'02_tensor': '⭐⭐',
|
||||
'03_activations': '⭐⭐',
|
||||
'04_layers': '⭐⭐⭐',
|
||||
'05_networks': '⭐⭐⭐',
|
||||
'06_cnn': '⭐⭐⭐⭐',
|
||||
'07_dataloader': '⭐⭐⭐',
|
||||
'08_autograd': '⭐⭐⭐⭐',
|
||||
'09_optimizers': '⭐⭐⭐⭐',
|
||||
'10_training': '⭐⭐⭐⭐',
|
||||
'11_compression': '⭐⭐⭐⭐⭐',
|
||||
'12_kernels': '⭐⭐⭐⭐⭐',
|
||||
'13_benchmarking': '⭐⭐⭐⭐⭐',
|
||||
'14_mlops': '⭐⭐⭐⭐⭐',
|
||||
'15_capstone': '⭐⭐⭐⭐⭐'
|
||||
}
|
||||
return difficulty_map.get(module_name, '⭐⭐')
|
||||
"""Get difficulty stars from module.yaml file."""
|
||||
# Map module number to module folder name
|
||||
module_path = Path(f'../modules/source/{module_name}')
|
||||
module_info = get_module_info(module_path)
|
||||
return module_info.get('difficulty', '⭐⭐')
|
||||
|
||||
def get_time_estimate(module_name: str) -> str:
|
||||
"""Get time estimate based on module name."""
|
||||
time_map = {
|
||||
'01_setup': '1-2 hours',
|
||||
'02_tensor': '4-6 hours',
|
||||
'03_activations': '3-4 hours',
|
||||
'04_layers': '4-5 hours',
|
||||
'05_networks': '5-6 hours',
|
||||
'06_cnn': '6-8 hours',
|
||||
'07_dataloader': '4-5 hours',
|
||||
'08_autograd': '6-8 hours',
|
||||
'09_optimizers': '5-6 hours',
|
||||
'10_training': '6-8 hours',
|
||||
'11_compression': '4-5 hours',
|
||||
'12_kernels': '5-6 hours',
|
||||
'13_benchmarking': '4-5 hours',
|
||||
'14_mlops': '6-8 hours',
|
||||
'15_capstone': 'Capstone Project'
|
||||
}
|
||||
return time_map.get(module_name, '3-4 hours')
|
||||
"""Get time estimate from module.yaml file."""
|
||||
# Map module number to module folder name
|
||||
module_path = Path(f'../modules/source/{module_name}')
|
||||
module_info = get_module_info(module_path)
|
||||
return module_info.get('time_estimate', '3-4 hours')
|
||||
|
||||
def get_prev_module_name(module_num: int) -> str:
|
||||
"""Get previous module name."""
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐"
|
||||
time_estimate: "1-2 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "personal_info"
|
||||
|
||||
@@ -16,8 +16,12 @@ exports_to: "tinytorch.core.tensor"
|
||||
# File Structure - What files exist in this module
|
||||
files:
|
||||
dev_file: "tensor_dev.py"
|
||||
test_file: "tests/test_tensor.py"
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐"
|
||||
time_estimate: "4-6 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
|
||||
@@ -16,8 +16,12 @@ exports_to: "tinytorch.core.activations"
|
||||
# File Structure - What files exist in this module
|
||||
files:
|
||||
dev_file: "activations_dev.py"
|
||||
test_file: "tests/test_activations.py"
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐"
|
||||
time_estimate: "3-4 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
|
||||
@@ -16,8 +16,12 @@ exports_to: "tinytorch.core.layers"
|
||||
# File Structure - What files exist in this module
|
||||
files:
|
||||
dev_file: "layers_dev.py"
|
||||
test_file: "tests/test_layers.py"
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐"
|
||||
time_estimate: "4-5 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐"
|
||||
time_estimate: "5-6 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "Sequential"
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐"
|
||||
time_estimate: "6-8 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "conv2d_naive"
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐"
|
||||
time_estimate: "5-6 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "Dataset"
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
test_file: "tests/test_autograd.py"
|
||||
readme: "README.md"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "8-10 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "Variable"
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "6-8 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "SGD"
|
||||
|
||||
@@ -19,6 +19,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "8-10 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "MeanSquaredError"
|
||||
|
||||
@@ -114,4 +114,14 @@ assessment_criteria:
|
||||
next_steps:
|
||||
- "Module 11: Kernels - Hardware-aware optimization"
|
||||
- "Module 12: Benchmarking - Performance measurement"
|
||||
- "Module 13: MLOps - Production deployment"
|
||||
- "Module 13: MLOps - Production deployment"
|
||||
|
||||
# File Structure - What files exist in this module
|
||||
files:
|
||||
dev_file: "compression_dev.py"
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "8-10 hours"
|
||||
@@ -23,6 +23,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "8-10 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "matmul_custom"
|
||||
|
||||
@@ -23,6 +23,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "4-5 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "TinyTorchPerf"
|
||||
|
||||
@@ -24,6 +24,10 @@ files:
|
||||
readme: "README.md"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐"
|
||||
time_estimate: "8-10 hours"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
- "ModelMonitor"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Essential system information for CLI tools and build systems
|
||||
|
||||
name: "capstone"
|
||||
title: "Capstone: Framework Optimization"
|
||||
title: "Capstone Project"
|
||||
description: "Optimize and extend your complete TinyTorch framework through systems engineering"
|
||||
|
||||
# Dependencies - Used by CLI for module ordering and prerequisites
|
||||
@@ -19,9 +19,13 @@ exports_to: "tinytorch.capstone"
|
||||
|
||||
# File Structure - What files exist in this module
|
||||
files:
|
||||
dev_file: "capstone_guide.md"
|
||||
dev_file: "capstone_dev.py"
|
||||
readme: "README.md"
|
||||
tests: "project_based"
|
||||
tests: "inline"
|
||||
|
||||
# Educational Metadata
|
||||
difficulty: "⭐⭐⭐⭐⭐ 🥷"
|
||||
time_estimate: "Capstone Project"
|
||||
|
||||
# Components - What's implemented in this module
|
||||
components:
|
||||
|
||||
Reference in New Issue
Block a user