diff --git a/tinytorch/_modidx.py b/tinytorch/_modidx.py index 7877386b..c7e9e588 100644 --- a/tinytorch/_modidx.py +++ b/tinytorch/_modidx.py @@ -59,6 +59,8 @@ d = { 'settings': { 'branch': 'main', 'tinytorch/benchmarking/benchmark.py'), 'tinytorch.benchmarking.benchmark.TinyMLPerf.run_standard_benchmark': ( '19_benchmarking/benchmarking_dev.html#tinymlperf.run_standard_benchmark', 'tinytorch/benchmarking/benchmark.py'), + 'tinytorch.benchmarking.benchmark.calculate_normalized_scores': ( '19_benchmarking/benchmarking_dev.html#calculate_normalized_scores', + 'tinytorch/benchmarking/benchmark.py'), 'tinytorch.benchmarking.benchmark.test_unit_benchmark': ( '19_benchmarking/benchmarking_dev.html#test_unit_benchmark', 'tinytorch/benchmarking/benchmark.py'), 'tinytorch.benchmarking.benchmark.test_unit_benchmark_suite': ( '19_benchmarking/benchmarking_dev.html#test_unit_benchmark_suite', @@ -75,6 +77,8 @@ d = { 'settings': { 'branch': 'main', 'tinytorch/competition/submit.py'), 'tinytorch.competition.submit.validate_installation': ( '20_competition/competition_dev.html#validate_installation', 'tinytorch/competition/submit.py'), + 'tinytorch.competition.submit.validate_submission': ( '20_competition/competition_dev.html#validate_submission', + 'tinytorch/competition/submit.py'), 'tinytorch.competition.submit.worked_example_optimization': ( '20_competition/competition_dev.html#worked_example_optimization', 'tinytorch/competition/submit.py')}, 'tinytorch.core.activations': { 'tinytorch.core.activations.GELU': ( '02_activations/activations_dev.html#gelu', diff --git a/tito/__pycache__/__init__.cpython-313.pyc b/tito/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..edd00a0a Binary files /dev/null and b/tito/__pycache__/__init__.cpython-313.pyc differ diff --git a/tito/__pycache__/main.cpython-313.pyc b/tito/__pycache__/main.cpython-313.pyc new file mode 100644 index 00000000..d62f5066 Binary files /dev/null and b/tito/__pycache__/main.cpython-313.pyc differ diff --git a/tito/commands/__init__.py b/tito/commands/__init__.py index e4b514b5..536f0665 100644 --- a/tito/commands/__init__.py +++ b/tito/commands/__init__.py @@ -20,8 +20,6 @@ from .status import StatusCommand from .clean import CleanCommand from .nbgrader import NBGraderCommand from .book import BookCommand -from .community import CommunityCommand -from .submit import SubmitCommand # Command groups from .system import SystemCommand @@ -43,8 +41,6 @@ __all__ = [ 'CleanCommand', 'NBGraderCommand', 'BookCommand', - 'CommunityCommand', - 'SubmitCommand', # Command groups 'SystemCommand', 'ModuleCommand', diff --git a/tito/commands/__pycache__/__init__.cpython-313.pyc b/tito/commands/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..0eb73da9 Binary files /dev/null and b/tito/commands/__pycache__/__init__.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/base.cpython-313.pyc b/tito/commands/__pycache__/base.cpython-313.pyc new file mode 100644 index 00000000..e7d0935c Binary files /dev/null and b/tito/commands/__pycache__/base.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/book.cpython-313.pyc b/tito/commands/__pycache__/book.cpython-313.pyc new file mode 100644 index 00000000..4821def6 Binary files /dev/null and b/tito/commands/__pycache__/book.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/checkpoint.cpython-313.pyc b/tito/commands/__pycache__/checkpoint.cpython-313.pyc new file mode 100644 index 00000000..672f4373 Binary files /dev/null and b/tito/commands/__pycache__/checkpoint.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/clean.cpython-313.pyc b/tito/commands/__pycache__/clean.cpython-313.pyc new file mode 100644 index 00000000..c624dab4 Binary files /dev/null and b/tito/commands/__pycache__/clean.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/demo.cpython-313.pyc b/tito/commands/__pycache__/demo.cpython-313.pyc new file mode 100644 index 00000000..b29b3393 Binary files /dev/null and b/tito/commands/__pycache__/demo.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/doctor.cpython-313.pyc b/tito/commands/__pycache__/doctor.cpython-313.pyc new file mode 100644 index 00000000..b852f96b Binary files /dev/null and b/tito/commands/__pycache__/doctor.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/export.cpython-313.pyc b/tito/commands/__pycache__/export.cpython-313.pyc new file mode 100644 index 00000000..ac4d9754 Binary files /dev/null and b/tito/commands/__pycache__/export.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/grade.cpython-313.pyc b/tito/commands/__pycache__/grade.cpython-313.pyc new file mode 100644 index 00000000..db876bf4 Binary files /dev/null and b/tito/commands/__pycache__/grade.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/info.cpython-313.pyc b/tito/commands/__pycache__/info.cpython-313.pyc new file mode 100644 index 00000000..e694c5dc Binary files /dev/null and b/tito/commands/__pycache__/info.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/jupyter.cpython-313.pyc b/tito/commands/__pycache__/jupyter.cpython-313.pyc new file mode 100644 index 00000000..6180af6f Binary files /dev/null and b/tito/commands/__pycache__/jupyter.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/leaderboard.cpython-313.pyc b/tito/commands/__pycache__/leaderboard.cpython-313.pyc new file mode 100644 index 00000000..ed4a4f29 Binary files /dev/null and b/tito/commands/__pycache__/leaderboard.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/logo.cpython-313.pyc b/tito/commands/__pycache__/logo.cpython-313.pyc new file mode 100644 index 00000000..3bd470b1 Binary files /dev/null and b/tito/commands/__pycache__/logo.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/milestone.cpython-313.pyc b/tito/commands/__pycache__/milestone.cpython-313.pyc new file mode 100644 index 00000000..d95c408e Binary files /dev/null and b/tito/commands/__pycache__/milestone.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/module.cpython-313.pyc b/tito/commands/__pycache__/module.cpython-313.pyc new file mode 100644 index 00000000..216f3de9 Binary files /dev/null and b/tito/commands/__pycache__/module.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/module_workflow.cpython-313.pyc b/tito/commands/__pycache__/module_workflow.cpython-313.pyc new file mode 100644 index 00000000..9ebdca52 Binary files /dev/null and b/tito/commands/__pycache__/module_workflow.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/nbdev.cpython-313.pyc b/tito/commands/__pycache__/nbdev.cpython-313.pyc new file mode 100644 index 00000000..7ac692fe Binary files /dev/null and b/tito/commands/__pycache__/nbdev.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/nbgrader.cpython-313.pyc b/tito/commands/__pycache__/nbgrader.cpython-313.pyc new file mode 100644 index 00000000..cc03c218 Binary files /dev/null and b/tito/commands/__pycache__/nbgrader.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/notebooks.cpython-313.pyc b/tito/commands/__pycache__/notebooks.cpython-313.pyc new file mode 100644 index 00000000..c3ceb50d Binary files /dev/null and b/tito/commands/__pycache__/notebooks.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/olympics.cpython-313.pyc b/tito/commands/__pycache__/olympics.cpython-313.pyc new file mode 100644 index 00000000..42f17d1a Binary files /dev/null and b/tito/commands/__pycache__/olympics.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/package.cpython-313.pyc b/tito/commands/__pycache__/package.cpython-313.pyc new file mode 100644 index 00000000..8b76405b Binary files /dev/null and b/tito/commands/__pycache__/package.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/protect.cpython-313.pyc b/tito/commands/__pycache__/protect.cpython-313.pyc new file mode 100644 index 00000000..2bad6fbe Binary files /dev/null and b/tito/commands/__pycache__/protect.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/reset.cpython-313.pyc b/tito/commands/__pycache__/reset.cpython-313.pyc new file mode 100644 index 00000000..b70563a1 Binary files /dev/null and b/tito/commands/__pycache__/reset.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/setup.cpython-313.pyc b/tito/commands/__pycache__/setup.cpython-313.pyc new file mode 100644 index 00000000..d263f56f Binary files /dev/null and b/tito/commands/__pycache__/setup.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/status.cpython-313.pyc b/tito/commands/__pycache__/status.cpython-313.pyc new file mode 100644 index 00000000..2e3f6c6a Binary files /dev/null and b/tito/commands/__pycache__/status.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/system.cpython-313.pyc b/tito/commands/__pycache__/system.cpython-313.pyc new file mode 100644 index 00000000..eee1005e Binary files /dev/null and b/tito/commands/__pycache__/system.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/test.cpython-313.pyc b/tito/commands/__pycache__/test.cpython-313.pyc new file mode 100644 index 00000000..2e18a8de Binary files /dev/null and b/tito/commands/__pycache__/test.cpython-313.pyc differ diff --git a/tito/commands/__pycache__/view.cpython-313.pyc b/tito/commands/__pycache__/view.cpython-313.pyc new file mode 100644 index 00000000..57cc2b62 Binary files /dev/null and b/tito/commands/__pycache__/view.cpython-313.pyc differ diff --git a/tito/commands/community.py b/tito/commands/community.py index 229e4f04..b7b19a85 100644 --- a/tito/commands/community.py +++ b/tito/commands/community.py @@ -1,7 +1,7 @@ """ -TinyTorch Community Command +TinyTorch Community Leaderboard Command -Inclusive community where everyone belongs, regardless of performance level. +Inclusive community showcase where everyone belongs, regardless of performance level. Celebrates the journey, highlights improvements, and builds community through shared learning. """ @@ -26,22 +26,22 @@ from ..core.exceptions import TinyTorchCLIError from .checkpoint import CheckpointSystem -class CommunityCommand(BaseCommand): - """Community - Everyone welcome, celebrate the journey together!""" +class LeaderboardCommand(BaseCommand): + """Community leaderboard - Everyone welcome, celebrate the journey!""" @property def name(self) -> str: - return "community" + return "leaderboard" @property def description(self) -> str: - return "Join the community, share progress, celebrate achievements together" + return "Community showcase - Join, share progress, celebrate achievements together" def add_arguments(self, parser: ArgumentParser) -> None: - """Add community subcommands.""" + """Add leaderboard subcommands.""" subparsers = parser.add_subparsers( - dest='community_command', - help='Community operations', + dest='leaderboard_command', + help='Leaderboard operations', metavar='COMMAND' ) @@ -69,32 +69,31 @@ class CommunityCommand(BaseCommand): help='Update existing registration' ) - # Share command (renamed from submit to avoid confusion with tito submit) - share_parser = subparsers.add_parser( - 'share', - help='Share your progress with the community (baseline or improvements welcome!)', - aliases=['submit'] # Keep 'submit' as alias for backward compatibility + # Submit command + submit_parser = subparsers.add_parser( + 'submit', + help='Submit your results (baseline or improvements welcome!)' ) - share_parser.add_argument( + submit_parser.add_argument( '--task', default='cifar10', choices=['cifar10', 'mnist', 'tinygpt'], - help='Task to share results for (default: cifar10)' + help='Task to submit results for (default: cifar10)' ) - share_parser.add_argument( + submit_parser.add_argument( '--accuracy', type=float, help='Accuracy achieved (any level welcome!)' ) - share_parser.add_argument( + submit_parser.add_argument( '--model', help='Model description (e.g., "CNN-3-layer", "Custom-Architecture")' ) - share_parser.add_argument( + submit_parser.add_argument( '--notes', help='Optional notes about your approach, learnings, challenges' ) - share_parser.add_argument( + submit_parser.add_argument( '--checkpoint', help='Which TinyTorch checkpoint you completed (e.g., "05", "10", "15")' ) @@ -161,17 +160,17 @@ class CommunityCommand(BaseCommand): ) def run(self, args: Namespace) -> int: - """Execute community command.""" - command = getattr(args, 'community_command', None) + """Execute leaderboard command.""" + command = getattr(args, 'leaderboard_command', None) if not command: - self._show_community_overview() + self._show_leaderboard_overview() return 0 if command in ['join', 'register']: return self._register_user(args) - elif command in ['share', 'submit']: # 'submit' kept as alias - return self._share_results(args) + elif command == 'submit': + return self._submit_results(args) elif command == 'view': return self._view_leaderboard(args) elif command == 'profile': @@ -185,11 +184,11 @@ class CommunityCommand(BaseCommand): else: raise TinyTorchCLIError(f"Unknown leaderboard command: {command}") - def _show_community_overview(self) -> None: - """Show community overview and welcome message.""" + def _show_leaderboard_overview(self) -> None: + """Show leaderboard overview and welcome message.""" self.console.print(Panel( Group( - Align.center("[bold bright_green]🌟 TinyTorch Community 🌟[/bold bright_green]"), + Align.center("[bold bright_green]🌟 TinyTorch Community Leaderboard 🌟[/bold bright_green]"), "", "[bold]Everyone Welcome![/bold] This is your inclusive community showcase where:", "• [green]Every achievement matters[/green] - 10% accuracy gets the same celebration as 90%", @@ -199,16 +198,16 @@ class CommunityCommand(BaseCommand): "", "[bold]Available Commands:[/bold]", " [green]join[/green] - Join our welcoming community (free, inclusive)", - " [green]share[/green] - Share your progress (any level welcome!)", + " [green]submit[/green] - Share your progress (any level welcome!)", " [green]view[/green] - See everyone's journey together", " [green]profile[/green] - Your personal achievement story", " [green]progress[/green] - Track your module completion journey", " [green]status[/green] - Quick stats and encouragement", " [green]help[/green] - Learn about the community system", "", - "[dim]šŸ’” Tip: Start with 'tito community join' to join the community![/dim]", + "[dim]šŸ’” Tip: Start with 'tito leaderboard join' to join the community![/dim]", ), - title="TinyTorch Community", + title="Community Leaderboard", border_style="bright_green", padding=(1, 2) )) @@ -559,13 +558,13 @@ class CommunityCommand(BaseCommand): "[bold bright_blue]šŸš€ Your Next Steps:[/bold bright_blue]", f"1. [green]{next_step}[/green]", "2. [blue]Train your first model and share results[/blue]", - "3. [yellow]Connect with peers: tito community view[/yellow]", + "3. [yellow]Connect with peers: tito leaderboard view[/yellow]", "", "[bold bright_blue]šŸ¤ Community Features Unlocked:[/bold bright_blue]", - "• [green]Submit results: tito community share[/green]", - "• [blue]View global progress: tito community view[/blue]", - "• [yellow]Track your journey: tito community profile[/yellow]", - "• [magenta]Get encouragement: tito community status[/magenta]", + "• [green]Submit results: tito leaderboard submit[/green]", + "• [blue]View global progress: tito leaderboard view[/blue]", + "• [yellow]Track your journey: tito leaderboard profile[/yellow]", + "• [magenta]Get encouragement: tito leaderboard status[/magenta]", "", "[dim]šŸ’ Remember: Every step forward is celebrated here![/dim]", ), @@ -591,14 +590,14 @@ class CommunityCommand(BaseCommand): padding=(1, 1) )) - def _share_results(self, args: Namespace) -> int: - """Share progress results with the community (encouraging experience).""" + def _submit_results(self, args: Namespace) -> int: + """Submit results with encouraging experience.""" # Check registration profile = self._load_user_profile() if not profile: self.console.print(Panel( "[yellow]Please join our community first![/yellow]\n\n" - "Run: [bold]tito community join[/bold]", + "Run: [bold]tito leaderboard join[/bold]", title="šŸ“ Community Membership Required", border_style="yellow" )) @@ -700,9 +699,9 @@ class CommunityCommand(BaseCommand): celebration_message["encouragement"], "", "[bold bright_blue]šŸ” Next:[/bold bright_blue]", - "• View community: [dim]tito community view[/dim]", - "• See your profile: [dim]tito community profile[/dim]", - "• Try improving: [dim]tito community share[/dim]", + "• View community: [dim]tito leaderboard view[/dim]", + "• See your profile: [dim]tito leaderboard profile[/dim]", + "• Try improving: [dim]tito leaderboard submit[/dim]", ), title=celebration_message["panel_title"], border_style=celebration_message["border_style"], @@ -733,7 +732,7 @@ class CommunityCommand(BaseCommand): if not profile: self.console.print(Panel( "[yellow]Please join our community first to see your profile![/yellow]\n\n" - "Run: [bold]tito community join[/bold]", + "Run: [bold]tito leaderboard join[/bold]", title="šŸ“ Community Membership Required", border_style="yellow" )) @@ -749,7 +748,7 @@ class CommunityCommand(BaseCommand): if not profile: self.console.print(Panel( "[yellow]Please join our community first![/yellow]\n\n" - "Run: [bold]tito community join[/bold]", + "Run: [bold]tito leaderboard join[/bold]", title="šŸ“ Community Membership Required", border_style="yellow" )) @@ -763,13 +762,13 @@ class CommunityCommand(BaseCommand): # Encouraging status message if total_submissions == 0: status_message = "[bold bright_blue]šŸš€ Ready for your first submission![/bold bright_blue]" - next_step = "Train any model and submit with: [green]tito community share[/green]" + next_step = "Train any model and submit with: [green]tito leaderboard submit[/green]" else: status_message = f"[bold bright_green]🌟 {total_submissions} submission{'s' if total_submissions != 1 else ''} made![/bold bright_green]" if best_cifar10 > 0: next_step = f"Best CIFAR-10: {best_cifar10:.1f}% - Keep improving! šŸš€" else: - next_step = "Try CIFAR-10 next: [green]tito community share --task cifar10[/green]" + next_step = "Try CIFAR-10 next: [green]tito leaderboard submit --task cifar10[/green]" self.console.print(Panel( Group( @@ -796,7 +795,7 @@ class CommunityCommand(BaseCommand): if not profile: self.console.print(Panel( "[yellow]Please join our community first to see your progress![/yellow]\n\n" - "Run: [bold]tito community join[/bold]", + "Run: [bold]tito leaderboard join[/bold]", title="šŸ“ Community Membership Required", border_style="yellow" )) @@ -865,8 +864,8 @@ class CommunityCommand(BaseCommand): self.console.print(Panel( f"[bold cyan]šŸŽÆ Quick Actions[/bold cyan]\n\n" + (f"[green]Continue Learning:[/green]\n[dim] tito module view {next_module}[/dim]\n\n" if next_module else "") + - f"[yellow]Submit Results:[/yellow]\n[dim] tito community share --task mnist --accuracy XX.X[/dim]\n\n" - f"[blue]View Community:[/blue]\n[dim] tito community view[/dim]\n\n" + f"[yellow]Submit Results:[/yellow]\n[dim] tito leaderboard submit --task mnist --accuracy XX.X[/dim]\n\n" + f"[blue]View Community:[/blue]\n[dim] tito leaderboard view[/dim]\n\n" f"[magenta]Track Progress:[/magenta]\n[dim] tito checkpoint status[/dim]", title="šŸš€ Next Steps", border_style="bright_blue" @@ -903,10 +902,10 @@ class CommunityCommand(BaseCommand): "• [magenta]Learn together[/magenta] - Community success > individual ranking", "", "[bold bright_blue]šŸŽÆ Getting started:[/bold bright_blue]", - "1. [dim]tito community join[/dim] - Join our welcoming community", + "1. [dim]tito leaderboard join[/dim] - Join our welcoming community", "2. Train any model using your TinyTorch implementations", - "3. [dim]tito community share --accuracy 25.3[/dim] - Share your results", - "4. [dim]tito community view[/dim] - See the community progress", + "3. [dim]tito leaderboard submit --accuracy 25.3[/dim] - Share your results", + "4. [dim]tito leaderboard view[/dim] - See the community progress", "", "[bold bright_green]šŸ’ Remember: This is about learning, growing, and supporting each other![/bold bright_green]", ), @@ -1081,8 +1080,8 @@ class CommunityCommand(BaseCommand): "• [blue]All achievers[/blue]: Every percentage point represents real learning", "• [yellow]Recent submissions[/yellow]: Fresh progress and new insights", "", - "[dim]šŸ’” See your progress: tito community profile[/dim]", - "[dim]šŸš€ Submit improvements: tito community share[/dim]", + "[dim]šŸ’” See your progress: tito leaderboard profile[/dim]", + "[dim]šŸš€ Submit improvements: tito leaderboard submit[/dim]", ), title="Community Insights", border_style="bright_blue", @@ -1141,7 +1140,7 @@ class CommunityCommand(BaseCommand): self.console.print(Panel( "[yellow]No recent submissions![/yellow]\n\n" "Be the first to share recent progress:\n" - "[bold]tito community share[/bold]", + "[bold]tito leaderboard submit[/bold]", title="šŸ”„ Recent Activity", border_style="yellow" )) @@ -1372,7 +1371,7 @@ class CommunityCommand(BaseCommand): # Submission-based suggestions if total_submissions == 0: suggestions.append("[yellow]Make your first submission:[/yellow] Any accuracy level welcome!") - suggestions.append("[dim] tito community share --task mnist --accuracy XX.X[/dim]") + suggestions.append("[dim] tito leaderboard submit --task mnist --accuracy XX.X[/dim]") elif best_accuracy >= 75: suggestions.append("[blue]Help others in the community:[/blue] Share your insights!") elif best_accuracy >= 50: @@ -1396,7 +1395,7 @@ class CommunityCommand(BaseCommand): f" • Connect with other ML learners\n" f" • Celebrate achievements together\n\n" f"[bold cyan]Ready to join?[/bold cyan]\n" - f"[dim] tito community join[/dim]", + f"[dim] tito leaderboard join[/dim]", title="šŸŽ† Join the Community", border_style="bright_green" )) @@ -1568,8 +1567,8 @@ class CommunityCommand(BaseCommand): (f"[bold yellow]šŸŽÆ Next Adventure:[/bold yellow] {next_module}\n" if next_module else f"[bold green]šŸ† All modules completed! You're an ML Systems Engineer![/bold green]\n") + f"\n[bold cyan]View your journey:[/bold cyan]\n" - f"[dim] tito community profile --detailed[/dim]\n" - f"[dim] tito community status[/dim]", + f"[dim] tito leaderboard profile --detailed[/dim]\n" + f"[dim] tito leaderboard status[/dim]", title=f"šŸŽ† {username}'s Achievement", border_style="bright_green" )) @@ -1581,7 +1580,7 @@ class CommunityCommand(BaseCommand): f"[bold cyan]šŸ”“ Unlocked Submissions:[/bold cyan]\n\n" + "\n".join(f" • [green]{task.upper()}[/green]" for task in eligible_submissions) + f"\n\n[yellow]Ready to submit your results?[/yellow]\n" - f"[dim] tito community share --task cifar10 --accuracy XX.X[/dim]", + f"[dim] tito leaderboard submit --task cifar10 --accuracy XX.X[/dim]", title="šŸ… New Opportunities", border_style="bright_cyan" )) \ No newline at end of file diff --git a/tito/commands/submit.py b/tito/commands/submit.py deleted file mode 100644 index bbe49544..00000000 --- a/tito/commands/submit.py +++ /dev/null @@ -1,423 +0,0 @@ -""" -TinyTorch Competition Submission Command - -Validates and prepares TinyMLPerf competition submissions from Module 20. -""" - -import json -import platform -from argparse import ArgumentParser, Namespace -from pathlib import Path -from typing import Dict, Any, Optional - -from rich.panel import Panel -from rich.table import Table -from rich.prompt import Prompt, Confirm -from rich.console import Group -from rich.align import Align - -from .base import BaseCommand -from ..core.exceptions import TinyTorchCLIError - - -class SubmitCommand(BaseCommand): - """Validate and submit TinyMLPerf competition entries""" - - @property - def name(self) -> str: - return "submit" - - @property - def description(self) -> str: - return "Validate and prepare TinyMLPerf competition submission" - - def add_arguments(self, parser: ArgumentParser) -> None: - """Add submit command arguments.""" - parser.add_argument( - 'submission_file', - type=str, - default='submission.json', - nargs='?', - help='Path to submission.json file (default: submission.json)' - ) - parser.add_argument( - '--github-repo', - type=str, - help='GitHub repository URL (overrides submission file)' - ) - parser.add_argument( - '--skip-validation', - action='store_true', - help='Skip validation checks (not recommended)' - ) - - def run(self, args: Namespace) -> int: - """Execute submit command.""" - submission_file = Path(args.submission_file) - - # Check if submission file exists - if not submission_file.exists(): - self.console.print(Panel( - f"[red]āŒ Submission file not found:[/red] {submission_file}\n\n" - f"[yellow]Expected file:[/yellow] submission.json\n" - f"[cyan]How to generate:[/cyan]\n" - f" 1. Open Module 20 (TinyMLPerf Competition)\n" - f" 2. Run the generate_submission() function\n" - f" 3. This will create submission.json\n\n" - f"[dim]Then run: tito submit submission.json[/dim]", - title="āŒ File Not Found", - border_style="red" - )) - return 1 - - # Load submission - try: - with open(submission_file, 'r') as f: - submission = json.load(f) - except json.JSONDecodeError as e: - self.console.print(Panel( - f"[red]āŒ Invalid JSON file:[/red] {submission_file}\n\n" - f"[yellow]Error:[/yellow] {str(e)}\n\n" - f"[cyan]Please regenerate submission.json from Module 20[/cyan]", - title="āŒ Invalid Submission", - border_style="red" - )) - return 1 - - # Welcome - self._show_welcome() - - # Validate submission - if not args.skip_validation: - validation_result = self._validate_submission(submission) - if not validation_result["valid"]: - self.console.print(Panel( - "[red]āŒ Submission validation failed[/red]\n\n" - "[yellow]Please fix the errors and regenerate submission.json[/yellow]", - title="Validation Failed", - border_style="red" - )) - return 1 - - # Display scorecard - self._display_scorecard(submission) - - # Collect additional info - submission = self._collect_additional_info(submission, args) - - # Honor code - if not self._confirm_honor_code(): - self.console.print(Panel( - "[yellow]Submission cancelled[/yellow]\n\n" - "Honor code agreement is required for competition submission.", - title="Cancelled", - border_style="yellow" - )) - return 1 - - submission["honor_code"] = True - - # Save final submission - final_file = self._save_final_submission(submission) - - # Show next steps - self._show_next_steps(final_file, submission) - - return 0 - - def _show_welcome(self) -> None: - """Show welcome message.""" - self.console.print(Panel( - Group( - Align.center("[bold bright_green]šŸ… TinyMLPerf Competition Submission šŸ…[/bold bright_green]"), - "", - "Welcome to the TinyMLPerf competition submission system!", - "", - "This tool will:", - "• [green]āœ“ Validate your submission[/green]", - "• [blue]āœ“ Display your normalized scorecard[/blue]", - "• [yellow]āœ“ Collect GitHub repository for verification[/yellow]", - "• [magenta]āœ“ Prepare final submission package[/magenta]", - "", - "[dim]Following MLPerf principles: Reproducible, fair, and transparent[/dim]", - ), - title="šŸ”„ Competition Submission", - border_style="bright_green", - padding=(1, 2) - )) - - def _validate_submission(self, submission: Dict[str, Any]) -> Dict[str, Any]: - """Validate submission with sanity checks.""" - self.console.print("\nšŸ” [bold cyan]Validating Submission...[/bold cyan]\n") - - checks = [] - warnings = [] - errors = [] - - # Extract metrics - normalized = submission.get("normalized_scores", {}) - speedup = normalized.get("speedup", 1.0) - compression = normalized.get("compression_ratio", 1.0) - accuracy_delta = normalized.get("accuracy_delta", 0.0) - - # Check 1: Speedup is reasonable - if speedup > 50: - errors.append(f"āŒ Speedup {speedup:.1f}x seems unrealistic (>50x)") - elif speedup > 20: - warnings.append(f"āš ļø Speedup {speedup:.1f}x is very high - please verify measurements") - else: - checks.append(f"āœ… Speedup {speedup:.2f}x is reasonable") - - # Check 2: Compression is reasonable - if compression > 32: - errors.append(f"āŒ Compression {compression:.1f}x seems unrealistic (>32x)") - elif compression > 16: - warnings.append(f"āš ļø Compression {compression:.1f}x is very high - please verify") - else: - checks.append(f"āœ… Compression {compression:.2f}x is reasonable") - - # Check 3: Accuracy preservation (Closed Division) - division = submission.get("division", "closed") - if division == "closed" and accuracy_delta > 1.0: - errors.append(f"āŒ Accuracy improved {accuracy_delta:.1f}pp - did you train the model?") - elif accuracy_delta > 0.5: - warnings.append(f"āš ļø Accuracy improved {accuracy_delta:.1f}pp - verify no training") - else: - checks.append(f"āœ… Accuracy Ī” {accuracy_delta:+.2f}pp is reasonable") - - # Check 4: Required fields - required = ["division", "event", "athlete_name", "baseline", "optimized", "normalized_scores"] - missing = [f for f in required if f not in submission] - if missing: - errors.append(f"āŒ Missing fields: {', '.join(missing)}") - else: - checks.append("āœ… All required fields present") - - # Check 5: Techniques documented - techniques = submission.get("techniques_applied", []) - if not techniques or "TODO" in str(techniques): - warnings.append("āš ļø No optimization techniques listed") - else: - checks.append(f"āœ… Techniques: {', '.join(techniques[:3])}{'...' if len(techniques) > 3 else ''}") - - # Display results - for check in checks: - self.console.print(f" {check}") - for warning in warnings: - self.console.print(f" {warning}") - for error in errors: - self.console.print(f" {error}") - - if errors: - self.console.print("\n[red]āŒ Validation failed - please fix errors above[/red]\n") - elif warnings: - self.console.print("\n[yellow]āš ļø Warnings detected - review before submitting[/yellow]\n") - else: - self.console.print("\n[green]āœ… All validation checks passed![/green]\n") - - return { - "valid": len(errors) == 0, - "checks": checks, - "warnings": warnings, - "errors": errors - } - - def _display_scorecard(self, submission: Dict[str, Any]) -> None: - """Display MLPerf-style scorecard with normalized metrics.""" - normalized = submission.get("normalized_scores", {}) - division = submission.get("division", "closed").upper() - event = submission.get("event", "all_around").replace("_", " ").title() - athlete = submission.get("athlete_name", "Unknown") - - # Create scorecard table - table = Table( - title=f"šŸ† TinyMLPerf Scorecard - {athlete}", - title_style="bold bright_green", - show_header=True, - header_style="bold cyan" - ) - table.add_column("Metric", style="bold", width=25) - table.add_column("Value", style="green", justify="right", width=20) - table.add_column("Rating", style="yellow", width=15) - - # Division & Event - table.add_row("Division", division, self._get_division_badge(division.lower())) - table.add_row("Event", event, self._get_event_badge(submission.get("event", ""))) - table.add_section() - - # Normalized scores - speedup = normalized.get("speedup", 1.0) - compression = normalized.get("compression_ratio", 1.0) - accuracy_delta = normalized.get("accuracy_delta", 0.0) - efficiency = normalized.get("efficiency_score", 1.0) - - table.add_row( - "Speedup", - f"{speedup:.2f}x faster", - self._get_performance_rating(speedup, "speedup") - ) - table.add_row( - "Compression", - f"{compression:.2f}x smaller", - self._get_performance_rating(compression, "compression") - ) - table.add_row( - "Accuracy Ī”", - f"{accuracy_delta:+.2f}pp", - self._get_accuracy_rating(accuracy_delta) - ) - table.add_row( - "Efficiency Score", - f"{efficiency:.2f}", - self._get_efficiency_rating(efficiency) - ) - - self.console.print(table) - - def _collect_additional_info(self, submission: Dict[str, Any], args: Namespace) -> Dict[str, Any]: - """Collect additional information for submission.""" - self.console.print("\nšŸ“ [bold cyan]Additional Information[/bold cyan]\n") - - # GitHub repo (required for verification) - current_repo = submission.get("github_repo", "") - if args.github_repo: - github_repo = args.github_repo - elif current_repo: - github_repo = Prompt.ask( - "[bold]GitHub repository URL[/bold] (for code verification)", - default=current_repo - ) - else: - github_repo = Prompt.ask( - "[bold]GitHub repository URL[/bold] (required for verification)", - default="https://github.com/YourUsername/TinyTorch" - ) - - submission["github_repo"] = github_repo - - # Environment info (for reproducibility) - submission["environment"] = { - "python_version": platform.python_version(), - "system": platform.system(), - "machine": platform.machine(), - "processor": platform.processor() or "Unknown" - } - - return submission - - def _confirm_honor_code(self) -> bool: - """Confirm honor code agreement.""" - self.console.print("\nšŸ“œ [bold cyan]Honor Code Agreement[/bold cyan]\n") - - self.console.print(Panel( - "[bold]TinyMLPerf Honor Code[/bold]\n\n" - "I affirm that:\n" - "• This submission represents my own work\n" - "• All techniques and optimizations are documented\n" - "• Results are reproducible from the provided repository\n" - "• I followed the competition rules for my division\n" - "• Measurements were conducted fairly and honestly\n\n" - "[yellow]Closed Division:[/yellow] No model training, architecture changes, or data modifications\n" - "[blue]Open Division:[/blue] Innovations are documented and reproducible", - title="Honor Code", - border_style="bright_blue" - )) - - return Confirm.ask("\n[bold]Do you agree to the honor code?[/bold]", default=True) - - def _save_final_submission(self, submission: Dict[str, Any]) -> Path: - """Save final submission with all information.""" - final_file = Path("submission_final.json") - - with open(final_file, 'w') as f: - json.dump(submission, f, indent=2) - - self.console.print(f"\nāœ… [green]Final submission saved:[/green] {final_file}") - - return final_file - - def _show_next_steps(self, final_file: Path, submission: Dict[str, Any]) -> None: - """Show next steps for submission.""" - github_repo = submission.get("github_repo", "") - - self.console.print(Panel( - Group( - "[bold bright_green]šŸŽ‰ Submission Ready![/bold bright_green]", - "", - "[bold]Your submission package:[/bold]", - f"• [green]Submission file:[/green] {final_file}", - f"• [blue]GitHub repo:[/blue] {github_repo}", - f"• [yellow]Honor code:[/yellow] Confirmed āœ“", - "", - "[bold bright_blue]šŸ“¤ Next Steps:[/bold bright_blue]", - "", - "[bold]Option 1: Email Submission[/bold]", - " 1. Email [cyan]submission_final.json[/cyan] to your instructor", - " 2. Include your GitHub repo link in the email", - " 3. Subject: [dim]TinyMLPerf Submission - [YourName][/dim]", - "", - "[bold]Option 2: Platform Upload[/bold]", - " 1. Go to competition platform (if available)", - " 2. Upload [cyan]submission_final.json[/cyan]", - " 3. Verify GitHub repo link is correct", - "", - "[bold green]šŸ” Verification:[/bold green]", - "• Instructor will clone your GitHub repo", - "• Reproduce your results using your code", - "• Verify optimizations match documentation", - "", - "[dim]šŸ’” Tip: Make sure your README.md explains how to reproduce your results![/dim]", - ), - title="āœ… Submission Complete", - border_style="bright_green", - padding=(1, 2) - )) - - # Helper methods for ratings - def _get_division_badge(self, division: str) -> str: - if division == "closed": - return "šŸ”’ Optimization" - elif division == "open": - return "šŸ”“ Innovation" - return "ā“ Unknown" - - def _get_event_badge(self, event: str) -> str: - badges = { - "latency_sprint": "šŸƒ Speed", - "memory_challenge": "šŸ‹ļø Size", - "accuracy_contest": "šŸŽÆ Accuracy", - "all_around": "šŸ‹ļøā€ā™‚ļø Balanced", - "extreme_push": "šŸš€ Extreme" - } - return badges.get(event, "šŸ“Š Custom") - - def _get_performance_rating(self, value: float, metric: str) -> str: - if value >= 10: - return "⭐⭐⭐ Elite" - elif value >= 5: - return "⭐⭐ Strong" - elif value >= 2: - return "⭐ Good" - else: - return "šŸ“Š Baseline" - - def _get_accuracy_rating(self, delta: float) -> str: - if abs(delta) <= 0.5: - return "⭐⭐⭐ Excellent" - elif abs(delta) <= 2.0: - return "⭐⭐ Good" - elif abs(delta) <= 5.0: - return "⭐ Acceptable" - else: - return "āš ļø High Loss" - - def _get_efficiency_rating(self, score: float) -> str: - if score >= 20: - return "⭐⭐⭐ Elite" - elif score >= 10: - return "⭐⭐ Strong" - elif score >= 5: - return "⭐ Good" - else: - return "šŸ“Š Baseline" - diff --git a/tito/core/__pycache__/__init__.cpython-313.pyc b/tito/core/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..09b3ce14 Binary files /dev/null and b/tito/core/__pycache__/__init__.cpython-313.pyc differ diff --git a/tito/core/__pycache__/config.cpython-313.pyc b/tito/core/__pycache__/config.cpython-313.pyc new file mode 100644 index 00000000..4f92b07a Binary files /dev/null and b/tito/core/__pycache__/config.cpython-313.pyc differ diff --git a/tito/core/__pycache__/console.cpython-313.pyc b/tito/core/__pycache__/console.cpython-313.pyc new file mode 100644 index 00000000..ee3f60e9 Binary files /dev/null and b/tito/core/__pycache__/console.cpython-313.pyc differ diff --git a/tito/core/__pycache__/exceptions.cpython-313.pyc b/tito/core/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 00000000..2bb8a733 Binary files /dev/null and b/tito/core/__pycache__/exceptions.cpython-313.pyc differ diff --git a/tito/core/__pycache__/status_analyzer.cpython-313.pyc b/tito/core/__pycache__/status_analyzer.cpython-313.pyc new file mode 100644 index 00000000..8980d802 Binary files /dev/null and b/tito/core/__pycache__/status_analyzer.cpython-313.pyc differ diff --git a/tito/core/__pycache__/virtual_env_manager.cpython-313.pyc b/tito/core/__pycache__/virtual_env_manager.cpython-313.pyc new file mode 100644 index 00000000..e762b8e5 Binary files /dev/null and b/tito/core/__pycache__/virtual_env_manager.cpython-313.pyc differ diff --git a/tito/main.py b/tito/main.py index 2cefe3a0..b45f8eee 100644 --- a/tito/main.py +++ b/tito/main.py @@ -22,6 +22,7 @@ from .core.console import get_console, print_banner, print_error, print_ascii_lo from .core.exceptions import TinyTorchCLIError from rich.panel import Panel from .commands.base import BaseCommand +from .commands.notebooks import NotebooksCommand from .commands.info import InfoCommand from .commands.test import TestCommand from .commands.doctor import DoctorCommand @@ -31,6 +32,7 @@ from .commands.jupyter import JupyterCommand from .commands.nbdev import NbdevCommand from .commands.status import StatusCommand from .commands.system import SystemCommand +from .commands.module_workflow import ModuleWorkflowCommand from .commands.package import PackageCommand from .commands.nbgrader import NBGraderCommand from .commands.book import BookCommand @@ -39,9 +41,8 @@ from .commands.grade import GradeCommand from .commands.demo import DemoCommand from .commands.logo import LogoCommand from .commands.milestone import MilestoneCommand -from .commands.community import CommunityCommand +from .commands.leaderboard import LeaderboardCommand from .commands.olympics import OlympicsCommand -from .commands.submit import SubmitCommand from .commands.setup import SetupCommand # Configure logging @@ -64,26 +65,23 @@ class TinyTorchCLI: self.config = CLIConfig.from_project_root() self.console = get_console() self.commands: Dict[str, Type[BaseCommand]] = { - # Core workflow (what students actually use) + # Essential commands 'setup': SetupCommand, - 'export': ExportCommand, - 'test': TestCommand, - 'submit': SubmitCommand, - # Community features - 'community': CommunityCommand, - # System management + # Hierarchical command groups only 'system': SystemCommand, + 'module': ModuleWorkflowCommand, 'package': PackageCommand, - # Assessment tools 'nbgrader': NBGraderCommand, - 'grade': GradeCommand, - # Progress tracking 'checkpoint': CheckpointCommand, 'milestone': MilestoneCommand, - # Special events + 'leaderboard': LeaderboardCommand, 'olympics': OlympicsCommand, - # Utilities + # Convenience commands + 'notebooks': NotebooksCommand, + 'export': ExportCommand, + 'test': TestCommand, 'book': BookCommand, + 'grade': GradeCommand, 'demo': DemoCommand, 'logo': LogoCommand, } @@ -95,47 +93,32 @@ class TinyTorchCLI: description="TinyTorch CLI - Build ML systems from scratch", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" -Core Workflow (what you'll use daily): - setup First-time environment setup - export Export module code to tinytorch package - test Run module tests - submit Submit TinyMLPerf competition entry (Module 20) +Command Groups: + system System environment and configuration commands + module Module development and management commands + package Package management and nbdev integration commands + nbgrader Assignment management and auto-grading commands + checkpoint Track ML systems engineering progress through checkpoints + milestone Epic capability achievements and ML systems mastery + leaderboard Join the inclusive community, share progress, celebrate achievements + olympics Special competition events with focused challenges and recognition -Community Features: - community Join community, share progress, celebrate achievements +Convenience Commands: + export Export modules to package (quick shortcut) + test Run tests (quick shortcut) + book Build and manage Jupyter Book + grade Simplified grading interface (wraps NBGrader) + demo Run AI capability demos (show what your framework can do!) -System Tools: - system System environment and configuration - package Package management and nbdev integration - checkpoint Track your learning progress - milestone Epic capability achievements - -Assessment: - nbgrader Assignment management and auto-grading - grade Simplified grading interface - -Special Events: - olympics Competition events and recognition - -Utilities: - book Build and manage Jupyter Book - demo Run AI capability demos - logo Learn about TinyTorch philosophy - -Daily Workflow: - # 1. Edit code in your IDE - cd modules/source/05_autograd/ - # Edit autograd_dev.py... - - # 2. Export and test - tito export 05 - tito test 05 - - # 3. Repeat for next module! - -Competition Workflow (Module 20): - # Edit Module 20, run cells → submission.json - tito submit submission.json +Examples: + tito setup First-time environment setup + tito module start 01 Start Module 01 (tensors) + tito module complete 01 Complete Module 01 (test + export) + tito module resume 02 Resume working on Module 02 + tito module status View your learning progress + tito system info Show system information + tito checkpoint timeline Visual progress timeline + tito book build Build the Jupyter Book locally """ ) @@ -225,38 +208,36 @@ Competition Workflow (Module 20): # Show ASCII logo first print_ascii_logo() - # Show enhanced help with simplified structure + # Show enhanced help with command groups self.console.print(Panel( - "[bold bright_cyan]Core Workflow (Daily Use):[/bold bright_cyan]\n" - " [bold green]setup[/bold green] - First-time environment setup\n" - " [bold green]export[/bold green] - Export module code to package\n" - " [bold green]test[/bold green] - Run module tests\n" - " [bold green]submit[/bold green] - Submit competition entry (Module 20)\n\n" - "[bold bright_blue]Community:[/bold bright_blue]\n" - " [bold bright_blue]community[/bold bright_blue] - Join, share progress, celebrate together\n\n" - "[bold yellow]Progress & Achievements:[/bold yellow]\n" - " [bold yellow]checkpoint[/bold yellow] - Track your learning progress\n" - " [bold yellow]milestone[/bold yellow] - Epic capability achievements\n\n" - "[bold magenta]Tools & Utilities:[/bold magenta]\n" - " [bold magenta]system[/bold magenta] - System tools\n" - " [bold magenta]package[/bold magenta] - Package management\n" - " [bold magenta]book[/bold magenta] - Build documentation\n" - " [bold magenta]demo[/bold magenta] - Show capabilities\n\n" - "[bold bright_green]šŸ“š Quick Start:[/bold bright_green]\n" - " [dim]# 1. Setup (one time)[/dim]\n" - " [cyan]tito setup[/cyan]\n\n" - " [dim]# 2. Daily workflow (edit → export → test)[/dim]\n" - " [dim]# Edit modules/source/05_autograd/autograd_dev.py[/dim]\n" - " [cyan]tito export 05[/cyan]\n" - " [cyan]tito test 05[/cyan]\n\n" - " [dim]# 3. Competition (Module 20)[/dim]\n" - " [dim]# Edit Module 20, run cells → submission.json[/dim]\n" - " [cyan]tito submit submission.json[/cyan]\n\n" + "[bold]Essential Commands:[/bold]\n" + " [bold cyan]setup[/bold cyan] - First-time environment setup\n\n" + "[bold]Command Groups:[/bold]\n" + " [bold green]system[/bold green] - System environment and configuration\n" + " [bold green]module[/bold green] - Module development and management\n" + " [bold green]package[/bold green] - Package management and nbdev integration\n" + " [bold green]nbgrader[/bold green] - Assignment management and auto-grading\n" + " [bold green]checkpoint[/bold green] - Track ML systems engineering progress\n" + " [bold magenta]milestone[/bold magenta] - Epic capability achievements and ML mastery\n" + " [bold bright_blue]leaderboard[/bold bright_blue] - Join the inclusive community, share progress\n" + " [bold bright_yellow]olympics[/bold bright_yellow] - Special competition events and recognition\n\n" + "[bold]Convenience Commands:[/bold]\n" + " [bold green]export[/bold green] - Export modules to package\n" + " [bold green]test[/bold green] - Run tests\n" + " [bold green]book[/bold green] - Build and manage Jupyter Book\n" + " [bold green]logo[/bold green] - Learn about TinyTorch philosophy\n" + "[bold]Quick Start:[/bold]\n" + " [dim]tito setup[/dim] - First-time environment setup\n" + " [dim]tito module start 01[/dim] - Start building tensors (first time)\n" + " [dim]tito module complete 01[/dim] - Complete Module 01 (test + export)\n" + " [dim]tito module start 02[/dim] - Begin activation functions\n" + " [dim]tito module status[/dim] - View your progress\n" "[bold]Get Help:[/bold]\n" - " [dim]tito --help[/dim] - Show all commands\n" - " [dim]tito community[/dim] - Community subcommands\n" - " [dim]tito system[/dim] - System subcommands", - title="šŸ”„ Welcome to TinyTorch!", + " [dim]tito system[/dim] - Show system subcommands\n" + " [dim]tito module[/dim] - Show module subcommands\n" + " [dim]tito package[/dim] - Show package subcommands\n" + " [dim]tito --help[/dim] - Show full help", + title="Welcome to TinyTorch!", border_style="bright_green" )) return 0