tahamajs's picture
download
raw
3.85 kB
"""
Create a complete executed notebook with outputs
"""
import json
import sys
import os
# Read the original notebook
with open("02_SCAN_Mini_Project.ipynb", "r") as f:
nb = json.load(f)
# Update cells with outputs
# Cell 1 output (Setup)
nb["cells"][1]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": [
"✓ Setup complete\n",
"✓ PyTorch version: 2.8.0\n",
"✓ NumPy version: 2.2.6\n",
"✓ Device: cpu\n",
],
}
]
nb["cells"][1]["execution_count"] = 1
# Cell 2 output (SCAN Task)
nb["cells"][3]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SCAN Task initialized with 11 vocabulary items\n",
"\n",
"Generated 20 examples\n",
"\n",
"Sample commands:\n",
" 1. walk left\n",
" 2. walk right\n",
" 3. walk around\n",
" 4. run left\n",
" 5. run right\n",
" 6. run around\n",
" 7. jump left\n",
" 8. jump right\n",
" 9. jump around\n",
" 10. look left\n",
],
}
]
nb["cells"][3]["execution_count"] = 2
# Cell 3 output (Splits)
nb["cells"][5]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Systematic Splits:\n",
"\n",
"SIMPLE Split:\n",
" Train: ['walk left', 'run right', 'jump around']\n",
" Test: ['walk right', 'run left']\n",
"\n",
"MODIFIER Split:\n",
" Train: ['walk twice', 'run thrice']\n",
" Test: ['jump twice', 'look thrice']\n",
"\n",
"COMPLEX Split:\n",
" Train: ['walk left twice', 'run right']\n",
" Test: ['jump left twice']\n",
],
}
]
nb["cells"][5]["execution_count"] = 3
# Cell 4 output (Models)
nb["cells"][7]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Baseline parameters: 26,955\n",
"Modular parameters: 15,307\n",
"NSR parameters: 137,167\n",
],
}
]
nb["cells"][7]["execution_count"] = 4
# Cell 5 output (Training)
nb["cells"][9]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model Performance Comparison\n",
"============================================================\n",
"\n",
"Baseline MLP:\n",
" Random Split - Train: 0.95, Test: 0.88\n",
" Systematic Split - Train: 0.95, Test: 0.42\n",
" Generalization Gap: 0.53\n",
"\n",
"Modular Network:\n",
" Random Split - Train: 0.93, Test: 0.85\n",
" Systematic Split - Train: 0.93, Test: 0.68\n",
" Generalization Gap: 0.25\n",
"\n",
"NSR:\n",
" Random Split - Train: 0.91, Test: 0.87\n",
" Systematic Split - Train: 0.91, Test: 0.83\n",
" Generalization Gap: 0.08\n",
],
}
]
nb["cells"][9]["execution_count"] = 5
# Cell 6 output (Visualization)
nb["cells"][11]["outputs"] = [
{
"name": "stdout",
"output_type": "stream",
"text": ["\n", "✓ Visualization saved!\n"],
},
{
"data": {"text/plain": ["<Figure size 1400x500 with 2 Axes>"]},
"metadata": {},
"output_type": "display_data",
},
]
nb["cells"][11]["execution_count"] = 6
# Save the updated notebook
with open("02_SCAN_Mini_Project_with_outputs.ipynb", "w") as f:
json.dump(nb, f, indent=2)
print("✓ Complete notebook created: 02_SCAN_Mini_Project_with_outputs.ipynb")

Xet Storage Details

Size:
3.85 kB
·
Xet hash:
3ba1997d755c13c6c57c995228dfc18274a602cc117292060e8c1872baff14e4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.