mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-03-12 00:03:35 -05:00
- Remove 5 outdated development guides that contradicted clean NBGrader/nbdev architecture - Update all documentation to reflect assignments/ directory structure - Remove references to deprecated #| hide approach and old command patterns - Ensure clean separation: NBGrader for assignments, nbdev for package export - Update README, Student Guide, and Instructor Guide with current workflows
253 lines
6.7 KiB
Plaintext
253 lines
6.7 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "fc1bae4e",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"# Assignment 0: Setup - TinyTorch Development Environment (INSTRUCTOR VERSION)\n",
|
|
"\n",
|
|
"This is the instructor solution version showing how solutions are filled in."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "876aef2e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| default_exp core.utils"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e9d346d7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| export\n",
|
|
"# Required imports for TinyTorch utilities\n",
|
|
"import sys\n",
|
|
"import platform\n",
|
|
"from datetime import datetime\n",
|
|
"import os\n",
|
|
"from pathlib import Path"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "687b365f",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\"",
|
|
"lines_to_next_cell": 1
|
|
},
|
|
"source": [
|
|
"## Problem 1: Hello Function (10 points)\n",
|
|
"\n",
|
|
"Write a function that displays a welcome message for TinyTorch."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "c8f5870e",
|
|
"metadata": {
|
|
"lines_to_next_cell": 1,
|
|
"nbgrader": {
|
|
"grade": false,
|
|
"grade_id": "hello_function",
|
|
"locked": false,
|
|
"schema_version": 3,
|
|
"solution": true,
|
|
"task": false
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| export\n",
|
|
"def hello_tinytorch():\n",
|
|
" \"\"\"\n",
|
|
" Display a welcome message for TinyTorch.\n",
|
|
" \n",
|
|
" This function should:\n",
|
|
" 1. Try to load ASCII art from 'tinytorch_flame.txt' if it exists\n",
|
|
" 2. If the file doesn't exist, display a simple text banner\n",
|
|
" 3. Print \"TinyTorch\" and \"Build ML Systems from Scratch!\"\n",
|
|
" 4. Handle any exceptions gracefully\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "3a6d8a5a",
|
|
"metadata": {
|
|
"lines_to_next_cell": 1,
|
|
"nbgrader": {
|
|
"grade": false,
|
|
"grade_id": "add_function",
|
|
"locked": false,
|
|
"schema_version": 3,
|
|
"solution": true,
|
|
"task": false
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| export\n",
|
|
"def add_numbers(a, b):\n",
|
|
" \"\"\"\n",
|
|
" Add two numbers together.\n",
|
|
" \n",
|
|
" Args:\n",
|
|
" a: First number (int or float)\n",
|
|
" b: Second number (int or float)\n",
|
|
" \n",
|
|
" Returns:\n",
|
|
" Sum of a and b\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "693d10ea",
|
|
"metadata": {
|
|
"lines_to_next_cell": 1,
|
|
"nbgrader": {
|
|
"grade": false,
|
|
"grade_id": "systeminfo_class",
|
|
"locked": false,
|
|
"schema_version": 3,
|
|
"solution": true,
|
|
"task": false
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| export\n",
|
|
"class SystemInfo:\n",
|
|
" \"\"\"\n",
|
|
" A class for collecting and displaying system information.\n",
|
|
" \"\"\"\n",
|
|
" \n",
|
|
" def __init__(self):\n",
|
|
" \"\"\"\n",
|
|
" Initialize the SystemInfo object.\n",
|
|
" Collect Python version, platform, and machine information.\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION\n",
|
|
" \n",
|
|
" def __str__(self):\n",
|
|
" \"\"\"\n",
|
|
" Return a formatted string representation of system information.\n",
|
|
" Format: \"Python X.Y.Z on Platform (Architecture)\"\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION\n",
|
|
" \n",
|
|
" def is_compatible(self):\n",
|
|
" \"\"\"\n",
|
|
" Check if the Python version is compatible (>= 3.8).\n",
|
|
" Returns True if compatible, False otherwise.\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "77e585a9",
|
|
"metadata": {
|
|
"nbgrader": {
|
|
"grade": false,
|
|
"grade_id": "developer_profile_class",
|
|
"locked": false,
|
|
"schema_version": 3,
|
|
"solution": true,
|
|
"task": false
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#| export\n",
|
|
"class DeveloperProfile:\n",
|
|
" \"\"\"\n",
|
|
" A class representing a developer profile.\n",
|
|
" \"\"\"\n",
|
|
" \n",
|
|
" def __init__(self, name=\"Student\", email=\"student@example.com\", affiliation=\"TinyTorch Community\", specialization=\"ML Systems\"):\n",
|
|
" \"\"\"\n",
|
|
" Initialize a developer profile.\n",
|
|
" \n",
|
|
" Args:\n",
|
|
" name: Developer's name\n",
|
|
" email: Developer's email\n",
|
|
" affiliation: Developer's affiliation or organization\n",
|
|
" specialization: Developer's area of specialization\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION\n",
|
|
" \n",
|
|
" def __str__(self):\n",
|
|
" \"\"\"\n",
|
|
" Return a basic string representation of the developer.\n",
|
|
" Format: \"Name (email)\"\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION\n",
|
|
" \n",
|
|
" def get_signature(self):\n",
|
|
" \"\"\"\n",
|
|
" Return a formatted signature for the developer.\n",
|
|
" Should include name, affiliation, and specialization.\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION\n",
|
|
" \n",
|
|
" def get_profile_info(self):\n",
|
|
" \"\"\"\n",
|
|
" Return comprehensive profile information as a dictionary.\n",
|
|
" \"\"\"\n",
|
|
" ### BEGIN SOLUTION\n",
|
|
" # YOUR CODE HERE\n",
|
|
" raise NotImplementedError()\n",
|
|
" ### END SOLUTION "
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"jupytext": {
|
|
"main_language": "python"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|