Rendered view of lab.md. Read it as a page; the download link gives you the raw Markdown working file.

Download lab.md

Lab — three-configuration training comparison and capstone brief

Time: 120 minutes — 15 setup, 70 for the three device runs (the Mac is pre-lab), 20 for the table and cost, 15 for evidence and the capstone outline. The Mac run is the pre-lab self-study task; the in-class block runs the T4 and the RTX card, then merges.

Prerequisite: S9; Python 3.14; the bundled dataset at data/fashion_subset.npz (6,000 Fashion-MNIST images, MIT, 2.6 MB, no download). The provenance and licence are in data/README.md.

You need to know: the same model and data on different accelerators isolates the device; seconds per epoch, peak memory, utilization and cost are the comparison; the first epoch may include a warm-up.

Safe-data acknowledgement: I have read the lab safe-data policy. I will use only the course-supplied synthetic media and will not upload real personal media to any cloud service.

Task

Train the same 298,858-parameter CNN on this MacBook, a free Kaggle T4 and the faculty RTX Pro 6000, merge the three runs into one comparison table, and recommend an accelerator for the unit's monthly retraining — then outline the capstone proposal.

Steps

1. Pre-lab: run the Mac

Before class, open notebook.ipynb and run the cells with S10_LABEL=mps (the default). The notebook takes its settings from environment variables, so in Jupyter put %env S10_LABEL=mps in a cell above the settings cell; from a shell, start Jupyter with S10_LABEL=mps jupyter lab. The full run is about 20 seconds on MPS and writes results/mps.json; the merge cell then writes results/comparison.csv. Bring the JSON to class.

# Optional CLI check on the Mac
python3 -c "import torch; print(torch.__version__, torch.backends.mps.is_available())"

2. In class: run the Kaggle T4

Console: create a private Kaggle notebook (Settings → Accelerator → GPU T4 ×2; the notebook uses one), and upload data/fashion_subset.npz to the working directory.

Add %env S10_LABEL=t4 as the first cell — Kaggle gives you no shell to export a variable into, so the magic sets it for the kernel — then run the cells and download results/t4.json. The settings cell asserts it sees CUDA, so a T4 that failed to attach stops the run instead of quietly writing a CPU row. Record the GPU name and the utilization from nvidia-smi while the run is active:

nvidia-smi --query-gpu=name,utilization.gpu,memory.used --format=csv

3. In class: run the faculty RTX Pro 6000

Copy the dataset and notebook to the faculty machine's course workspace (or use the shared folder). Put %env S10_LABEL=rtx and %env S10_HOURLY_COST=1.69 in a cell above the settings cell — 1.69 is the notional RunPod secure price; the faculty card itself costs the student nothing. Run the cells, capture the utilization screenshot, and copy results/rtx.json back to the Mac.

If you use RunPod instead: book a 45–60 minute slot on the instructor-owned account, use a PyTorch image, upload the 2.6 MB dataset and the notebook, set auto-stop to 30 minutes idle, and terminate the pod and its network volume at the end. The 10-minute run costs about $0.28 at $1.69/hour.

4. Merge and price the comparison

Put all three JSONs in results/ and run the merge cell. It writes results/comparison.csv. Fill the cost column: Mac $0; T4 $0 within the weekly quota; RTX $0 to the student plus the notional RunPod line; RunPod actual = hourly price × hours used, plus any volume charge.

Read the table and answer:

  • Which device was fastest per epoch, and how much of the difference is the first-epoch warm-up?
  • What does the peak memory mean for a 16 GB T4 versus a 96 GB card?
  • Which device would you choose for the unit's monthly retraining, and what would change your mind?

5. Write the evidence note

Write 150–250 words: the comparison, the cost line, the utilization observation and the recommendation. Attach comparison.csv, the three JSONs and the utilization screenshot. A screenshot of a bill is not a utilization screenshot.

6. Outline the capstone proposal

In the last 15 minutes, draft the outline for the revised capstone, which starts in earnest after this session. The common brief is to add AI tagging to the 5,000-asset library, with a governance rule, inside a fixed monthly budget, on the course stack. The starter pack is course/samples/capstone/; read its README.md and COMMANDS.md before you start, and do not begin the implementation until the proposal names every component.

Sketch:

  • the problem and scope in one paragraph;
  • an architecture diagram with four components and their data flows: R2 with its private catalogue/tags bucket and its public thumbnail bucket labelled separately, the Nextcloud/RAID NAS as origin and backup, the Worker as the API and write gate, and the inference path — managed OpenRouter, the fine-tuned Qwen3.5-4B, or the S10 classifier;
  • the governance rule: the S8 six-part rule plus the tag schema, where the dated endpoint snapshot is checked before sending, and where the Worker refuses a non-compliant record;
  • the risk-register seed: three rows from S7/S8, each with its control;
  • the budget arithmetic: the $80 spine, the fixed $5 inference line, the $10 one-off backfill cap, and what the bounded 72-hour window does to the compute and storage lines;
  • the feasibility argument, including the accelerator choice from this lab and the 5,000-asset run in batches of 100;
  • the method choice and why it beats the other two for this catalogue.

The full 1,000-word proposal is due one week after this session; this outline is the in-class start, and the one-hour self-study block finishes it. The implementation must tag all 5,000 assets with at least 99% schema-valid records and prove the gate with a refusal and an accepted governed write. The report is 2,500 words with a 10-minute presentation and 5 minutes of questions.

Evidence bundle

  • results/comparison.csv and the three result JSONs.
  • A GPU utilization screenshot from the T4 and the RTX card (or the RunPod pod).
  • The 150–250 word what this proves note with the recommendation.
  • The capstone proposal outline.
  • A teardown log: Kaggle session stopped, faculty kernel stopped, RunPod pod and network volume terminated, budget checked.

The bundle is scored 3/2/1/0.

Failure and recovery

The deliberate failure is mislabelling a device: run the notebook on the Mac with S10_LABEL=t4 and watch the assertion refuse it. The table must record what actually ran; a borrowed row is labelled borrowed and a measured row is labelled measured. If the RTX card is unavailable, the T4 becomes the third configuration and the note says so. If both GPUs are unavailable, use the instructor's precomputed rtx.json, label it borrowed, and still run the Mac row. Never fill a GPU row with an estimate and call it measured.

Cost ceiling

$0 on the Mac, the free T4 and the faculty card. A RunPod fallback is under $3.40 at $1.69/hour for two hours; the lab run itself is about $0.28. The dataset is 2.6 MB, so transfer is negligible. There is no persistent storage.

Teardown

  • Mac: stop the kernel; copy results/; delete the run folder.
  • Kaggle: stop the session after downloading the JSON and screenshot.
  • Faculty RTX: stop the kernel and remove the outputs from the shared workspace.
  • RunPod: terminate the pod and its network volume; confirm the billing page shows no running instance. An auto-stop is not a teardown.

Fallback

T4 as the third configuration if the RTX card is unavailable; the instructor's precomputed RTX JSON if neither GPU is available, labelled borrowed. The Mac path always works. The evidence shape does not change.

Notebook

Open the lab notebook; run it once per device with S10_LABEL set to mps, t4 or rtx. It writes one JSON per run, then merges comparison.csv.