mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-04-28 02:27:43 -05:00
- Fixed test functions to only run when modules executed directly - Added proper __name__ == '__main__' guards to all test calls - Fixed syntax errors from incorrect replacements in Module 13 and 15 - Modules now import properly without executing tests - ProductionBenchmarkingProfiler (Module 14) and ProductionMLSystemProfiler (Module 16) fully working - Other profiler classes present but require full numpy environment to test completely
21 lines
562 B
Python
21 lines
562 B
Python
#!/usr/bin/env python3
|
|
"""Fix syntax errors in mlops_dev.py"""
|
|
|
|
import re
|
|
|
|
# Read the file
|
|
with open('modules/source/15_mlops/mlops_dev.py', 'r') as f:
|
|
content = f.read()
|
|
|
|
# Fix the malformed function definitions
|
|
# Pattern: def if __name__ == "__main__":\n function_name():
|
|
pattern = r'def if __name__ == "__main__":\n (\w+)\(\):'
|
|
replacement = r'def \1():'
|
|
|
|
content = re.sub(pattern, replacement, content)
|
|
|
|
# Write back
|
|
with open('modules/source/15_mlops/mlops_dev.py', 'w') as f:
|
|
f.write(content)
|
|
|
|
print("✅ Fixed syntax errors in mlops_dev.py") |