mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-03-11 22:53:34 -05:00
- Restored tools/py_to_notebook.py as a focused, standalone tool - Updated tito notebooks command to use subprocess to call the separate tool - Maintains clean separation of concerns: tito.py for CLI orchestration, py_to_notebook.py for conversion logic - Updated documentation to use 'tito notebooks' command instead of direct tool calls - Benefits: easier debugging, better maintainability, focused single-responsibility modules
704 lines
26 KiB
Plaintext
704 lines
26 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "raw",
|
|
"metadata": {},
|
|
"source": [
|
|
"---\n",
|
|
"output-file: setup_dev.html\n",
|
|
"title: \"Module 0: Setup - Tiny\\U0001F525Torch Development Workflow\"\n",
|
|
"\n",
|
|
"---\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a1a9c143",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\"",
|
|
"lines_to_next_cell": 1
|
|
},
|
|
"source": [
|
|
"## Step 1: Understanding the Module → Package Structure\n",
|
|
"\n",
|
|
"**🎓 Teaching vs. 🔧 Building**: This course has two sides:\n",
|
|
"- **Teaching side**: You work in `modules/setup/setup_dev.ipynb` (learning-focused)\n",
|
|
"- **Building side**: Your code exports to `tinytorch/core/utils.py` (production package)\n",
|
|
"\n",
|
|
"**Key Concept**: The `#| default_exp core.utils` directive at the top tells nbdev to export all `#| export` cells to `tinytorch/core/utils.py`.\n",
|
|
"\n",
|
|
"This separation allows us to:\n",
|
|
"- Organize learning by **concepts** (modules) \n",
|
|
"- Organize code by **function** (package structure)\n",
|
|
"- Build a real ML framework while learning systematically\n",
|
|
"\n",
|
|
"Let's write a simple \"Hello World\" function with the `#| export` directive:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 0,
|
|
"has_sd": true,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/markdown": [
|
|
"---\n",
|
|
"\n",
|
|
"### add_numbers\n",
|
|
"\n",
|
|
"> add_numbers (a, b)\n",
|
|
"\n",
|
|
"*Add two numbers together.\n",
|
|
"\n",
|
|
"TODO: Implement addition of two numbers.\n",
|
|
"This is the foundation of all mathematical operations in ML.*"
|
|
],
|
|
"text/plain": [
|
|
"---\n",
|
|
"\n",
|
|
"### add_numbers\n",
|
|
"\n",
|
|
"> add_numbers (a, b)\n",
|
|
"\n",
|
|
"*Add two numbers together.\n",
|
|
"\n",
|
|
"TODO: Implement addition of two numbers.\n",
|
|
"This is the foundation of all mathematical operations in ML.*"
|
|
]
|
|
},
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"#| echo: false\n",
|
|
"#| output: asis\n",
|
|
"show_doc(add_numbers)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 0,
|
|
"has_sd": true,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/markdown": [
|
|
"---\n",
|
|
"\n",
|
|
"### hello_tinytorch\n",
|
|
"\n",
|
|
"> hello_tinytorch ()\n",
|
|
"\n",
|
|
"*A simple hello world function for TinyTorch.\n",
|
|
"\n",
|
|
"TODO: Implement this function to display TinyTorch ASCII art and welcome message.\n",
|
|
"Load the flame art from tinytorch_flame.txt file with graceful fallback.*"
|
|
],
|
|
"text/plain": [
|
|
"---\n",
|
|
"\n",
|
|
"### hello_tinytorch\n",
|
|
"\n",
|
|
"> hello_tinytorch ()\n",
|
|
"\n",
|
|
"*A simple hello world function for TinyTorch.\n",
|
|
"\n",
|
|
"TODO: Implement this function to display TinyTorch ASCII art and welcome message.\n",
|
|
"Load the flame art from tinytorch_flame.txt file with graceful fallback.*"
|
|
]
|
|
},
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"#| echo: false\n",
|
|
"#| output: asis\n",
|
|
"show_doc(hello_tinytorch)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "b28103af",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"### 🧪 Test Your Implementation\n",
|
|
"\n",
|
|
"Once you implement the functions above, run this cell to test them:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "a1beca72",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2025-07-10T23:28:59.088616Z",
|
|
"iopub.status.busy": "2025-07-10T23:28:59.088506Z",
|
|
"iopub.status.idle": "2025-07-10T23:28:59.091981Z",
|
|
"shell.execute_reply": "2025-07-10T23:28:59.091554Z"
|
|
},
|
|
"language": "python"
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Testing hello_tinytorch():\n",
|
|
". . ... ....... .... ... . . .. .... . .. . . . . . .... \n",
|
|
". . .. .++. .. . . . .. ... . . . .. ... .. \n",
|
|
" . . . .=++=.. . . . .. . . .. . ... .. . . \n",
|
|
". .. ... .++++=. . . . . .. . .. .\n",
|
|
". . . . ....-+++++.... ... .. . .... .. . . . . . . . . . . . . \n",
|
|
" . .. ...-++++++-...... .. . ..... ..-:.. .. . .... .. . . .. . .. . . . \n",
|
|
" .. .. ..++++++++-.. . . ..##... -%#. . . . . . \n",
|
|
". .. .:+++++++++.... ... . ...:%%:............:-:. ..... ...... . . ....... .. . . \n",
|
|
" ..+++++++++++. ... . .. .=#%%##+.-##..#%####%%=.=%%. .*%+.. . . . ... \n",
|
|
" . ..++++++++++++...-++..... . .%%... -##..##=...=%#..*%*..=%#.. . .. ... . . . . .. . ...\n",
|
|
" ..-+++++++++++++..=++++... .....%#.. -##..#%-.. -##. .%%=.%%.. . . . . . ... .\n",
|
|
". .=++++++++++++++-+++++++.... . ...%%:...-##..#%-. .-%#. ..#%#%=.. . .. ... . . . .\n",
|
|
"..=+++++++++++++++++++++++-. . ..=%%%+.-%#..##-. .-%#....-%%*.. . .. . .. .. .. \n",
|
|
".:+++++++++++=+++++++++++++. . ................ .......-%%... . .. . . .. . \n",
|
|
".++++++++++===+++++++++++++: . .................... . ...%%%#:........ . .. ..... ......... ....\n",
|
|
":+++++++++====+++++++++++++=.. ...-----------.....-+#*=:.....-------:.......:=*#+-.. ..--:.....--=.\n",
|
|
":++++++++======++++++++++++=.. ...#%%%%%%%%%#..-#%%###%%#=...#%####%%%=...+%%%###%%#...#%+.. ..#%%.\n",
|
|
".+++++++========+++++++++++- .. .#%%.. ..-%%+.. ..-%%+..#%*.. .*%%..*%%:. ..#%*..#%+... .#%%.\n",
|
|
".=++++++==========+++++++++: . .#%%.....#%#.... .*%#..#%*...-%%*..#%+. ... . ..##%#####%%%.\n",
|
|
"..++++++===========+++++++-. . ...#%%. . .#%#. . .*%#..#%%%%%%#-. .#%+. . ....#%*-----#%%.\n",
|
|
"...+++++===========++++++=. . . . .#%%... -%%+.....=%%+..#%*..+%%-. .*%%-.....#%*..%%+.. ..%%%.\n",
|
|
". ..-+++===========+++++.. . .. ..#%%. .:%%%###%%%=...#%*...+%%=...+%%####%%#...%%+.. ..%%%.\n",
|
|
" . ...-++==========+++:.... ... . .===. ... ..-+++=.. ..-=-....-==: ..:=+++-.. ..==-... .===.\n",
|
|
" ....-+=======+-...... .. . . ... . . .. ... . . .... . . . . ..... . ... ..... .\n",
|
|
" .... . ......:..... ... . .. . ... . . ... . . . ... . . . ... .. ..... . . \n",
|
|
"\n",
|
|
"Tiny🔥Torch\n",
|
|
"Build ML Systems from Scratch!\n",
|
|
"\n",
|
|
"Testing add_numbers():\n",
|
|
"2 + 3 = 5\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Test the functions in the notebook (will fail until implemented)\n",
|
|
"try:\n",
|
|
" print(\"Testing hello_tinytorch():\")\n",
|
|
" hello_tinytorch()\n",
|
|
" print()\n",
|
|
" print(\"Testing add_numbers():\")\n",
|
|
" print(f\"2 + 3 = {add_numbers(2, 3)}\")\n",
|
|
"except NotImplementedError as e:\n",
|
|
" print(f\"⚠️ {e}\")\n",
|
|
" print(\"Implement the functions above first!\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "887b9723",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\"",
|
|
"lines_to_next_cell": 1
|
|
},
|
|
"source": [
|
|
"## Step 2: A Simple Class\n",
|
|
"\n",
|
|
"Let's create a simple class that will help us understand system information. This is still basic, but shows how to structure classes in TinyTorch."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 0,
|
|
"has_sd": true,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/markdown": [
|
|
"---\n",
|
|
"\n",
|
|
"### SystemInfo\n",
|
|
"\n",
|
|
"> SystemInfo ()\n",
|
|
"\n",
|
|
"*Simple system information class.\n",
|
|
"\n",
|
|
"TODO: Implement this class to collect and display system information.*"
|
|
],
|
|
"text/plain": [
|
|
"---\n",
|
|
"\n",
|
|
"### SystemInfo\n",
|
|
"\n",
|
|
"> SystemInfo ()\n",
|
|
"\n",
|
|
"*Simple system information class.\n",
|
|
"\n",
|
|
"TODO: Implement this class to collect and display system information.*"
|
|
]
|
|
},
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"#| echo: false\n",
|
|
"#| output: asis\n",
|
|
"show_doc(SystemInfo)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a182b8ad",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"### 🧪 Test Your SystemInfo Class\n",
|
|
"\n",
|
|
"Once you implement the SystemInfo class above, run this cell to test it:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "bfd7d3c4",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2025-07-10T23:28:59.101366Z",
|
|
"iopub.status.busy": "2025-07-10T23:28:59.101221Z",
|
|
"iopub.status.idle": "2025-07-10T23:28:59.103476Z",
|
|
"shell.execute_reply": "2025-07-10T23:28:59.103228Z"
|
|
},
|
|
"language": "python"
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Testing SystemInfo class:\n",
|
|
"System: Python 3.13 on Darwin (arm64)\n",
|
|
"Compatible: True\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Test the SystemInfo class (will fail until implemented)\n",
|
|
"try:\n",
|
|
" print(\"Testing SystemInfo class:\")\n",
|
|
" info = SystemInfo()\n",
|
|
" print(f\"System: {info}\")\n",
|
|
" print(f\"Compatible: {info.is_compatible()}\")\n",
|
|
"except NotImplementedError as e:\n",
|
|
" print(f\"⚠️ {e}\")\n",
|
|
" print(\"Implement the SystemInfo class above first!\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "9a14de41",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\"",
|
|
"lines_to_next_cell": 1
|
|
},
|
|
"source": [
|
|
"## Step 3: Developer Personalization\n",
|
|
"\n",
|
|
"Let's make TinyTorch yours! Create a developer profile that will identify you throughout your ML systems journey."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 0,
|
|
"has_sd": true,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/markdown": [
|
|
"---\n",
|
|
"\n",
|
|
"### DeveloperProfile\n",
|
|
"\n",
|
|
"> DeveloperProfile (name='Vijay Janapa Reddi', affiliation='Harvard\n",
|
|
"> University', email='vj@eecs.harvard.edu',\n",
|
|
"> github_username='profvjreddi', ascii_art=None)\n",
|
|
"\n",
|
|
"*Developer profile for personalizing TinyTorch experience.\n",
|
|
"\n",
|
|
"TODO: Implement this class to store and display developer information.\n",
|
|
"Default to course instructor but allow students to personalize.*"
|
|
],
|
|
"text/plain": [
|
|
"---\n",
|
|
"\n",
|
|
"### DeveloperProfile\n",
|
|
"\n",
|
|
"> DeveloperProfile (name='Vijay Janapa Reddi', affiliation='Harvard\n",
|
|
"> University', email='vj@eecs.harvard.edu',\n",
|
|
"> github_username='profvjreddi', ascii_art=None)\n",
|
|
"\n",
|
|
"*Developer profile for personalizing TinyTorch experience.\n",
|
|
"\n",
|
|
"TODO: Implement this class to store and display developer information.\n",
|
|
"Default to course instructor but allow students to personalize.*"
|
|
]
|
|
},
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"#| echo: false\n",
|
|
"#| output: asis\n",
|
|
"show_doc(DeveloperProfile)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "b848981d",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"### 🧪 Test Your Developer Profile\n",
|
|
"\n",
|
|
"Customize your developer profile! Replace the default information with your own:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "5d80e79c",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2025-07-10T23:28:59.114628Z",
|
|
"iopub.status.busy": "2025-07-10T23:28:59.114540Z",
|
|
"iopub.status.idle": "2025-07-10T23:28:59.118055Z",
|
|
"shell.execute_reply": "2025-07-10T23:28:59.117792Z"
|
|
},
|
|
"language": "python"
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Testing DeveloperProfile (with defaults):\n",
|
|
"Profile: 👨💻 Vijay Janapa Reddi | Harvard University | @profvjreddi\n",
|
|
"Signature: Built by Vijay Janapa Reddi (@profvjreddi)\n",
|
|
"\n",
|
|
"🎨 ASCII Art Preview:\n",
|
|
". . ... ....... .... ... . . .. .... . .. . . . . . .... \n",
|
|
". . .. .++. .. . . . .. ... . . . .. ... .. \n",
|
|
" . . . .=++=.. . . . .. . . .. . ... .. . . \n",
|
|
". .. ... .++++=. . . . . .. . .. .\n",
|
|
". . . . ....-+++++.... ... .. . .... .. . . . . . . . . . . . . \n",
|
|
" . .. ...-++++++-...... .. . ..... ..-:.. .. . .... .. . . .. . .. . . . \n",
|
|
" .. .. ..++++++++-.. . . ..##... -%#. . . . . . \n",
|
|
". .. .:+++++++++.... ... . ...:%%:............:-:. ..... ...... . . ....... .. . . \n",
|
|
" ..+++++++++++. ... . .. .=#%%##+.-##..#%####%%=.=%%. .*%+.. . . . ... \n",
|
|
" . ..++++++++++++...-++..... . .%%... -##..##=...=%#..*%*..=%#.. . .. ... . . . . .. . ...\n",
|
|
" ..-+++++++++++++..=++++... .....%#.. -##..#%-.. -##. .%%=.%%.. . . . . . ... .\n",
|
|
". .=++++++++++++++-+++++++.... . ...%%:...-##..#%-. .-%#. ..#%#%=.. . .. ... . . . .\n",
|
|
"..=+++++++++++++++++++++++-. . ..=%%%+.-%#..##-. .-%#....-%%*.. . .. . .. .. .. \n",
|
|
".:+++++++++++=+++++++++++++. . ................ .......-%%... . .. . . .. . \n",
|
|
".++++++++++===+++++++++++++: . .................... . ...%%%#:........ . .. ..... ......... ....\n",
|
|
":+++++++++====+++++++++++++=.. ...-----------.....-+#*=:.....-------:.......:=*#+-.. ..--:.....--=.\n",
|
|
":++++++++======++++++++++++=.. ...#%%%%%%%%%#..-#%%###%%#=...#%####%%%=...+%%%###%%#...#%+.. ..#%%.\n",
|
|
".+++++++========+++++++++++- .. .#%%.. ..-%%+.. ..-%%+..#%*.. .*%%..*%%:. ..#%*..#%+... .#%%.\n",
|
|
".=++++++==========+++++++++: . .#%%.....#%#.... .*%#..#%*...-%%*..#%+. ... . ..##%#####%%%.\n",
|
|
"..++++++===========+++++++-. . ...#%%. . .#%#. . .*%#..#%%%%%%#-. .#%+. . ....#%*-----#%%.\n",
|
|
"...+++++===========++++++=. . . . .#%%... -%%+.....=%%+..#%*..+%%-. .*%%-.....#%*..%%+.. ..%%%.\n",
|
|
". ..-+++===========+++++.. . .. ..#%%. .:%%%###%%%=...#%*...+%%=...+%%####%%#...%%+.. ..%%%.\n",
|
|
" . ...-++==========+++:.... ... . .===. ... ..-+++=.. ..-=-....-==: ..:=+++-.. ..==-... .===.\n",
|
|
" ....-+=======+-...... .. . . ... . . .. ... . . .... . . . . ..... . ... ..... .\n",
|
|
" .... . ......:..... ... . .. . ... . . ... . . . ... . . . ... .. ..... . . \n",
|
|
"\n",
|
|
"\n",
|
|
" Tiny🔥Torch\n",
|
|
" Build ML Systems from Scratch!\n",
|
|
" \n",
|
|
"\n",
|
|
"🔥 Full Profile Display:\n",
|
|
". . ... ....... .... ... . . .. .... . .. . . . . . .... \n",
|
|
". . .. .++. .. . . . .. ... . . . .. ... .. \n",
|
|
" . . . .=++=.. . . . .. . . .. . ... .. . . \n",
|
|
". .. ... .++++=. . . . . .. . .. .\n",
|
|
". . . . ....-+++++.... ... .. . .... .. . . . . . . . . . . . . \n",
|
|
" . .. ...-++++++-...... .. . ..... ..-:.. .. . .... .. . . .. . .. . . . \n",
|
|
" .. .. ..++++++++-.. . . ..##... -%#. . . . . . \n",
|
|
". .. .:+++++++++.... ... . ...:%%:............:-:. ..... ...... . . ....... .. . . \n",
|
|
" ..+++++++++++. ... . .. .=#%%##+.-##..#%####%%=.=%%. .*%+.. . . . ... \n",
|
|
" . ..++++++++++++...-++..... . .%%... -##..##=...=%#..*%*..=%#.. . .. ... . . . . .. . ...\n",
|
|
" ..-+++++++++++++..=++++... .....%#.. -##..#%-.. -##. .%%=.%%.. . . . . . ... .\n",
|
|
". .=++++++++++++++-+++++++.... . ...%%:...-##..#%-. .-%#. ..#%#%=.. . .. ... . . . .\n",
|
|
"..=+++++++++++++++++++++++-. . ..=%%%+.-%#..##-. .-%#....-%%*.. . .. . .. .. .. \n",
|
|
".:+++++++++++=+++++++++++++. . ................ .......-%%... . .. . . .. . \n",
|
|
".++++++++++===+++++++++++++: . .................... . ...%%%#:........ . .. ..... ......... ....\n",
|
|
":+++++++++====+++++++++++++=.. ...-----------.....-+#*=:.....-------:.......:=*#+-.. ..--:.....--=.\n",
|
|
":++++++++======++++++++++++=.. ...#%%%%%%%%%#..-#%%###%%#=...#%####%%%=...+%%%###%%#...#%+.. ..#%%.\n",
|
|
".+++++++========+++++++++++- .. .#%%.. ..-%%+.. ..-%%+..#%*.. .*%%..*%%:. ..#%*..#%+... .#%%.\n",
|
|
".=++++++==========+++++++++: . .#%%.....#%#.... .*%#..#%*...-%%*..#%+. ... . ..##%#####%%%.\n",
|
|
"..++++++===========+++++++-. . ...#%%. . .#%#. . .*%#..#%%%%%%#-. .#%+. . ....#%*-----#%%.\n",
|
|
"...+++++===========++++++=. . . . .#%%... -%%+.....=%%+..#%*..+%%-. .*%%-.....#%*..%%+.. ..%%%.\n",
|
|
". ..-+++===========+++++.. . .. ..#%%. .:%%%###%%%=...#%*...+%%=...+%%####%%#...%%+.. ..%%%.\n",
|
|
" . ...-++==========+++:.... ... . .===. ... ..-+++=.. ..-=-....-==: ..:=+++-.. ..==-... .===.\n",
|
|
" ....-+=======+-...... .. . . ... . . .. ... . . .... . . . . ..... . ... ..... .\n",
|
|
" .... . ......:..... ... . .. . ... . . ... . . . ... . . . ... .. ..... . . \n",
|
|
"\n",
|
|
"\n",
|
|
" Tiny🔥Torch\n",
|
|
" Build ML Systems from Scratch!\n",
|
|
" \n",
|
|
"\n",
|
|
"👨💻 Developer: Vijay Janapa Reddi\n",
|
|
"🏛️ Affiliation: Harvard University\n",
|
|
"📧 Email: vj@eecs.harvard.edu\n",
|
|
"🐙 GitHub: @profvjreddi\n",
|
|
"🔥 Ready to build ML systems from scratch!\n",
|
|
"\n",
|
|
"\n",
|
|
"🎯 YOUR TURN: Create your own profile!\n",
|
|
"Uncomment and modify the lines below:\n",
|
|
"# my_profile = DeveloperProfile(\n",
|
|
"# name='Your Name',\n",
|
|
"# affiliation='Your University/Company',\n",
|
|
"# email='your.email@example.com',\n",
|
|
"# github_username='yourgithub',\n",
|
|
"# ascii_art='''\n",
|
|
"# Your Custom ASCII Art Here!\n",
|
|
"# Maybe your initials, a logo, or something fun!\n",
|
|
"# '''\n",
|
|
"# )\n",
|
|
"# print(f'My Profile: {my_profile}')\n",
|
|
"# print(f'My Signature: {my_profile.get_signature()}')\n",
|
|
"# print(my_profile.get_full_profile())\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# Test the DeveloperProfile class\n",
|
|
"try:\n",
|
|
" print(\"Testing DeveloperProfile (with defaults):\")\n",
|
|
" # Default profile (instructor)\n",
|
|
" default_profile = DeveloperProfile()\n",
|
|
" print(f\"Profile: {default_profile}\")\n",
|
|
" print(f\"Signature: {default_profile.get_signature()}\")\n",
|
|
" print()\n",
|
|
" \n",
|
|
" print(\"🎨 ASCII Art Preview:\")\n",
|
|
" print(default_profile.get_ascii_art())\n",
|
|
" print()\n",
|
|
" \n",
|
|
" print(\"🔥 Full Profile Display:\")\n",
|
|
" print(default_profile.get_full_profile())\n",
|
|
" print()\n",
|
|
" \n",
|
|
" # TODO: Students should customize this with their own information!\n",
|
|
" print(\"🎯 YOUR TURN: Create your own profile!\")\n",
|
|
" print(\"Uncomment and modify the lines below:\")\n",
|
|
" print(\"# my_profile = DeveloperProfile(\")\n",
|
|
" print(\"# name='Your Name',\")\n",
|
|
" print(\"# affiliation='Your University/Company',\")\n",
|
|
" print(\"# email='your.email@example.com',\")\n",
|
|
" print(\"# github_username='yourgithub',\")\n",
|
|
" print(\"# ascii_art='''\")\n",
|
|
" print(\"# Your Custom ASCII Art Here!\")\n",
|
|
" print(\"# Maybe your initials, a logo, or something fun!\")\n",
|
|
" print(\"# '''\")\n",
|
|
" print(\"# )\")\n",
|
|
" print(\"# print(f'My Profile: {my_profile}')\")\n",
|
|
" print(\"# print(f'My Signature: {my_profile.get_signature()}')\")\n",
|
|
" print(\"# print(my_profile.get_full_profile())\")\n",
|
|
" \n",
|
|
"except NotImplementedError as e:\n",
|
|
" print(f\"⚠️ {e}\")\n",
|
|
" print(\"Implement the DeveloperProfile class above first!\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "4f117574",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"### 🎨 Personalization Challenge\n",
|
|
"\n",
|
|
"**For Students**: Make TinyTorch truly yours by:\n",
|
|
"\n",
|
|
"1. **Update your profile** in the cell above with your real information\n",
|
|
"2. **Create custom ASCII art** - your initials, a simple logo, or something that represents you\n",
|
|
"3. **Customize the flame file** - edit `tinytorch_flame.txt` to create your own default art\n",
|
|
"4. **Add your signature** to code you write throughout the course\n",
|
|
"5. **Show off your full profile** with the `get_full_profile()` method\n",
|
|
"\n",
|
|
"This isn't just about customization - it's about taking ownership of your learning journey in ML systems!\n",
|
|
"\n",
|
|
"**ASCII Art Customization Options:**\n",
|
|
"\n",
|
|
"**Option 1: Custom ASCII Art Parameter**\n",
|
|
"```python\n",
|
|
"my_profile = DeveloperProfile(\n",
|
|
" name=\"Your Name\",\n",
|
|
" ascii_art='''\n",
|
|
" Your Custom ASCII Art Here!\n",
|
|
" Maybe your initials, a logo, or something fun!\n",
|
|
" '''\n",
|
|
")\n",
|
|
"```\n",
|
|
"\n",
|
|
"**Option 2: Edit the Default Flame File**\n",
|
|
"- Edit `tinytorch_flame.txt` in this directory\n",
|
|
"- Replace with your own ASCII art design\n",
|
|
"- All students using defaults will see your custom art!\n",
|
|
"\n",
|
|
"**ASCII Art Ideas:**\n",
|
|
"- Your initials in block letters\n",
|
|
"- A simple logo or symbol that represents you\n",
|
|
"- Your university mascot in ASCII\n",
|
|
"- A coding-themed design\n",
|
|
"- Something that motivates you!\n",
|
|
"\n",
|
|
"**Pro Tip**: The `tinytorch_flame.txt` file contains the beautiful default flame art. You can:\n",
|
|
"- Edit it directly for a personalized default\n",
|
|
"- Create your own `.txt` file and modify the code to load it\n",
|
|
"- Use online ASCII art generators for inspiration"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "3e34c7fe",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"## Step 4: Try the Export Process\n",
|
|
"\n",
|
|
"Now let's export our code! In your terminal, run:\n",
|
|
"\n",
|
|
"```bash\n",
|
|
"python bin/tito.py sync --module setup\n",
|
|
"```\n",
|
|
"\n",
|
|
"This will export the code marked with `#| export` to `tinytorch/core/utils.py`.\n",
|
|
"\n",
|
|
"**What happens during export:**\n",
|
|
"1. nbdev scans this notebook for `#| export` cells\n",
|
|
"2. Extracts the Python code \n",
|
|
"3. Writes it to `tinytorch/core/utils.py` (because of `#| default_exp core.utils`)\n",
|
|
"4. Handles imports and dependencies automatically\n",
|
|
"\n",
|
|
"**🔍 Verification**: After export, check `tinytorch/core/utils.py` - you'll see your functions there with auto-generated headers pointing back to this notebook!\n",
|
|
"\n",
|
|
"**Note**: The export process will use the instructor solutions (from `#|hide` cells) so the package will have working implementations even if you haven't completed the exercises yet."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "641ad5d7",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"## Step 5: Run Tests\n",
|
|
"\n",
|
|
"After exporting, run the tests:\n",
|
|
"\n",
|
|
"```bash\n",
|
|
"python bin/tito.py test --module setup\n",
|
|
"```\n",
|
|
"\n",
|
|
"This will run all tests for the setup module and verify your implementation works correctly.\n",
|
|
"\n",
|
|
"## Step 6: Check Your Progress\n",
|
|
"\n",
|
|
"See your overall progress:\n",
|
|
"\n",
|
|
"```bash\n",
|
|
"python bin/tito.py info\n",
|
|
"```\n",
|
|
"\n",
|
|
"This shows which modules are complete and which are pending."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "7a09b00d",
|
|
"metadata": {
|
|
"cell_marker": "\"\"\""
|
|
},
|
|
"source": [
|
|
"## 🎉 Congratulations!\n",
|
|
"\n",
|
|
"You've learned the TinyTorch development workflow:\n",
|
|
"\n",
|
|
"1. ✅ Write code in notebooks with `#| export`\n",
|
|
"2. ✅ Export with `tito sync --module setup` \n",
|
|
"3. ✅ Test with `tito test --module setup`\n",
|
|
"4. ✅ Check progress with `tito info`\n",
|
|
"\n",
|
|
"**This is the rhythm you'll use for every module in TinyTorch.**\n",
|
|
"\n",
|
|
"### Next Steps\n",
|
|
"\n",
|
|
"Ready for the real work? Head to **Module 1: Tensor** where you'll build the core data structures that power everything else in TinyTorch.\n",
|
|
"\n",
|
|
"**Development Tips:**\n",
|
|
"- Always test your code in the notebook first\n",
|
|
"- Export frequently to catch issues early \n",
|
|
"- Read error messages carefully - they're designed to help\n",
|
|
"- When stuck, check if your code exports cleanly first\n",
|
|
"\n",
|
|
"Happy building! 🔥"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"jupytext": {
|
|
"main_language": "python"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.3"
|
|
},
|
|
"widgets": {
|
|
"application/vnd.jupyter.widget-state+json": {
|
|
"state": {},
|
|
"version_major": 2,
|
|
"version_minor": 0
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|