week07_lora.ipynb

Download .ipynb · Deliverables hub

Open in Jupyter from repo: jupyter notebook mmc/notebooks/week07_lora.ipynb

Cell 1 · markdown

# Week 7 — LoRA adapter checkpoint

**MMC / DeepMind track** — show-work notebook.

### How to run

- **Local (Anaconda):** from repo root  
  `conda activate controlsift-mmc` then `powershell -File scripts/start_mmc_jupyter.ps1`  
  or open this file in JupyterLab and use kernel **Python (controlsift-mmc)**.
- **GitHub Pages cannot execute notebooks** (static hosting only). After the repo is on GitHub, use **Open in Colab** / Binder links on the deliverables hub, or clone and run locally.

## Official DeepMind labs (checkbox)

- `vendor/ai-foundations/course_5/gdm_lab_5_5_implement_lora_for_parameter_efficient_fine_tuning.ipynb`
- `vendor/ai-foundations/course_5/gdm_lab_5_6_fine_tune_gemma_with_lora.ipynb`

Full map: `mmc/GDM_LAB_MAP.md`. Upstream clone: `vendor/ai-foundations/`.

## ControlSift exceed path

Run the cells below to regenerate **this repo's** graded artifacts under `mmc/deliverables/outputs/`.
Do not invent Gemma metrics; leave GPU rows null until a real HF/Kaggle run.

Cell 2 · code

from pathlib import Path
import os
import sys

# Resolve repo root whether Jupyter cwd is repo root or mmc/notebooks/
here = Path.cwd().resolve()
root = None
for candidate in [here, *here.parents]:
    if (candidate / "mmc" / "labs").is_dir() and (candidate / "mmc" / "notebooks").is_dir():
        root = candidate
        break
if root is None:
    raise RuntimeError("Could not find ControlSift repo root (expected mmc/labs/). Open Jupyter from the repo.")
os.chdir(root)
if str(root) not in sys.path:
    sys.path.insert(0, str(root))
print("cwd:", Path.cwd())
print("python:", sys.executable)

Cell 3 · code

from mmc.labs.week07_lora_scaffold import run
import json

result = run()
show = {k: result.get(k) for k in ['status', 'rank', 'toy_adapter', 'production_path']} if ['status', 'rank', 'toy_adapter', 'production_path'] else result
print(json.dumps(show, indent=2, default=str))
result

Cell 4 · markdown

### Next

1. Open the matching official GDM notebook under `vendor/ai-foundations/` and complete it on Skills/Colab if your cohort requires the upstream lab.
2. Confirm artifacts landed in `mmc/deliverables/outputs/`.
3. Sync the public hub: `python -m mmc.labs.sync_artifacts`.