[PR #1352] [MERGED] refactor(labs): migrate 30 labs to Pattern C (closes out #1347) #8140

Closed
opened 2026-04-27 17:26:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/harvard-edge/cs249r_book/pull/1352
Author: @profvjreddi
Created: 4/16/2026
Status: Merged
Merged: 4/16/2026
Merged by: @profvjreddi

Base: devHead: refactor/all-labs-pattern-c


📝 Commits (10+)

  • 36e70b4 refactor(labs/lab_02): Pattern C migration
  • 033d1e7 refactor(labs/lab_03_ml_workflow): Pattern C migration
  • b8640e4 refactor(labs/lab_04_data_engr): Pattern C migration
  • ddce2e7 refactor(labs/lab_05_nn_compute): Pattern C migration
  • 16d80b9 refactor(labs/lab_06_nn_arch): Pattern C migration
  • 733a5ee refactor(labs/lab_07_ml_frameworks): Pattern C migration
  • 1239677 refactor(labs/lab_08_model_train): Pattern C migration
  • 2d1e6c5 refactor(labs/lab_09_data_selection): Pattern C migration
  • 0cef280 refactor(labs/lab_10_model_compress): Pattern C migration
  • 905f69b refactor(labs/lab_11_hw_accel): Pattern C migration

📊 Changes

31 files changed (+110 additions, -370 deletions)

View changed files

📝 labs/tests/test_static.py (+3 -13)
📝 labs/vol1/lab_01_ml_intro.py (+4 -12)
📝 labs/vol1/lab_02_ml_systems.py (+3 -11)
📝 labs/vol1/lab_03_ml_workflow.py (+3 -11)
📝 labs/vol1/lab_04_data_engr.py (+3 -11)
📝 labs/vol1/lab_05_nn_compute.py (+3 -11)
📝 labs/vol1/lab_06_nn_arch.py (+3 -11)
📝 labs/vol1/lab_07_ml_frameworks.py (+3 -11)
📝 labs/vol1/lab_08_model_train.py (+3 -11)
📝 labs/vol1/lab_09_data_selection.py (+3 -11)
📝 labs/vol1/lab_10_model_compress.py (+4 -14)
📝 labs/vol1/lab_11_hw_accel.py (+4 -14)
📝 labs/vol1/lab_12_perf_bench.py (+3 -11)
📝 labs/vol1/lab_13_model_serving.py (+3 -11)
📝 labs/vol1/lab_14_ml_ops.py (+3 -11)
📝 labs/vol1/lab_15_responsible_engr.py (+3 -11)
📝 labs/vol1/lab_16_ml_conclusion.py (+4 -14)
📝 labs/vol2/lab_01_introduction.py (+4 -12)
📝 labs/vol2/lab_02_compute_infra.py (+4 -14)
📝 labs/vol2/lab_03_communication.py (+4 -14)

...and 11 more files

📄 Description

completes the systematic migration started by #1351 (lab_06 proof). 30 labs refactored across vol1 and vol2, each verified individually.

what changed

for each lab, a script applied the Pattern C transformation:

  1. remove cell-level mo.stop(<prediction>.value is None, ...) calls from @app.cell widget cells
  2. simplify cell signatures when the gate dep was only used in the removed mo.stop
  3. trust the internal build_part_X() gates that already exist in every lab (they already show the 'unlock' callout inside each tab until that part's prediction is answered)

labs updated (30, one commit each)

vol1 vol2
lab_01_ml_intro ✓ lab_01_introduction ✓
lab_02_ml_systems ✓ lab_02_compute_infra ✓
lab_03_ml_workflow ✓ lab_03_communication ✓
lab_04_data_engr ✓ lab_04_data_storage ✓
lab_05_nn_compute ✓ lab_07_fleet_orch ✓
lab_06_nn_arch ✓ lab_08_inference ✓
lab_07_ml_frameworks ✓ lab_09_perf_engineering ✓
lab_08_model_train ✓ lab_10_edge_intelligence ✓
lab_09_data_selection ✓ lab_11_ops_scale ✓
lab_10_model_compress ✓ lab_12_security_privacy ✓
lab_11_hw_accel ✓ lab_13_robust_ai ✓
lab_12_perf_bench ✓ lab_14_sustainable_ai ✓
lab_13_model_serving ✓ lab_15_responsible_ai ✓
lab_14_ml_ops ✓ lab_16_fleet_synthesis ✓
lab_15_responsible_engr ✓
lab_16_ml_conclusion ✓

not touched:

  • vol2/lab_05_dist_train — already Pattern C (no changes needed)
  • vol2/lab_06_fault_tolerance — merged via [GH-ISSUE #304] Suggestion: Cite the following papers (#1351)
  • vol1/lab_00_introduction — its check1/check2/check3 pattern is structurally different, mechanical transformation broke engine tests, kept in the grandfather list in #1347 for manual refactor

verification

each lab passed:

  • marimo check — clean
  • pytest labs/tests/test_engine.py -k <lab_name> — cells execute, produce outputs
  • if any lab failed either check, the branch was reverted (that's what happened to lab_00, reverted cleanly)

full repo run after all commits:

  • pytest labs/tests/test_static.py — 688 passed, 5 skipped (grandfather list + pre-existing), 1 xfailed (unrelated)
  • pytest labs/tests/test_engine.py — 70 passed

commits

30 per-lab commits + 1 grandfather-list update. each per-lab commit is independently reviewable (small diff, typically 3-14 lines).

  • #1347 — the tracking issue. this PR closes out 30 of 31 remaining labs; only lab_00 still open.
  • #1350 — the test refinement (multi-widget leak threshold with grandfather list). this PR shrinks the grandfather list to just {lab_00}.
  • #1351 — the proof-of-pattern PR (lab_06), landed first to validate the approach.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/harvard-edge/cs249r_book/pull/1352 **Author:** [@profvjreddi](https://github.com/profvjreddi) **Created:** 4/16/2026 **Status:** ✅ Merged **Merged:** 4/16/2026 **Merged by:** [@profvjreddi](https://github.com/profvjreddi) **Base:** `dev` ← **Head:** `refactor/all-labs-pattern-c` --- ### 📝 Commits (10+) - [`36e70b4`](https://github.com/harvard-edge/cs249r_book/commit/36e70b42218ea8194cf48c951df2d9e2d2edc27c) refactor(labs/lab_02): Pattern C migration - [`033d1e7`](https://github.com/harvard-edge/cs249r_book/commit/033d1e7c447101948902b1e5cdee048cde1659a2) refactor(labs/lab_03_ml_workflow): Pattern C migration - [`b8640e4`](https://github.com/harvard-edge/cs249r_book/commit/b8640e452729518099f0dd0d785b49caadd22e01) refactor(labs/lab_04_data_engr): Pattern C migration - [`ddce2e7`](https://github.com/harvard-edge/cs249r_book/commit/ddce2e73798a3f821051c11333810e11a11adde9) refactor(labs/lab_05_nn_compute): Pattern C migration - [`16d80b9`](https://github.com/harvard-edge/cs249r_book/commit/16d80b907216984c8f18b4b89ee25fe654042101) refactor(labs/lab_06_nn_arch): Pattern C migration - [`733a5ee`](https://github.com/harvard-edge/cs249r_book/commit/733a5ee86fea5ba0c6cb74d7d4f11aa427502a34) refactor(labs/lab_07_ml_frameworks): Pattern C migration - [`1239677`](https://github.com/harvard-edge/cs249r_book/commit/1239677a8e2f8ee44c4ab72aa9a83433a05f2e3e) refactor(labs/lab_08_model_train): Pattern C migration - [`2d1e6c5`](https://github.com/harvard-edge/cs249r_book/commit/2d1e6c598f2e543ec6ed87d57c5aea6d8160e300) refactor(labs/lab_09_data_selection): Pattern C migration - [`0cef280`](https://github.com/harvard-edge/cs249r_book/commit/0cef28085f1a720c4b7b9c94666d3afe1e4cad8e) refactor(labs/lab_10_model_compress): Pattern C migration - [`905f69b`](https://github.com/harvard-edge/cs249r_book/commit/905f69b64b3b2cc830bc2d7cbc6ec953a1a66041) refactor(labs/lab_11_hw_accel): Pattern C migration ### 📊 Changes **31 files changed** (+110 additions, -370 deletions) <details> <summary>View changed files</summary> 📝 `labs/tests/test_static.py` (+3 -13) 📝 `labs/vol1/lab_01_ml_intro.py` (+4 -12) 📝 `labs/vol1/lab_02_ml_systems.py` (+3 -11) 📝 `labs/vol1/lab_03_ml_workflow.py` (+3 -11) 📝 `labs/vol1/lab_04_data_engr.py` (+3 -11) 📝 `labs/vol1/lab_05_nn_compute.py` (+3 -11) 📝 `labs/vol1/lab_06_nn_arch.py` (+3 -11) 📝 `labs/vol1/lab_07_ml_frameworks.py` (+3 -11) 📝 `labs/vol1/lab_08_model_train.py` (+3 -11) 📝 `labs/vol1/lab_09_data_selection.py` (+3 -11) 📝 `labs/vol1/lab_10_model_compress.py` (+4 -14) 📝 `labs/vol1/lab_11_hw_accel.py` (+4 -14) 📝 `labs/vol1/lab_12_perf_bench.py` (+3 -11) 📝 `labs/vol1/lab_13_model_serving.py` (+3 -11) 📝 `labs/vol1/lab_14_ml_ops.py` (+3 -11) 📝 `labs/vol1/lab_15_responsible_engr.py` (+3 -11) 📝 `labs/vol1/lab_16_ml_conclusion.py` (+4 -14) 📝 `labs/vol2/lab_01_introduction.py` (+4 -12) 📝 `labs/vol2/lab_02_compute_infra.py` (+4 -14) 📝 `labs/vol2/lab_03_communication.py` (+4 -14) _...and 11 more files_ </details> ### 📄 Description completes the systematic migration started by #1351 (lab_06 proof). 30 labs refactored across vol1 and vol2, each verified individually. ## what changed for each lab, a script applied the Pattern C transformation: 1. remove cell-level `mo.stop(<prediction>.value is None, ...)` calls from @app.cell widget cells 2. simplify cell signatures when the gate dep was only used in the removed mo.stop 3. trust the internal `build_part_X()` gates that already exist in every lab (they already show the 'unlock' callout inside each tab until that part's prediction is answered) ## labs updated (30, one commit each) | vol1 | vol2 | |------|------| | lab_01_ml_intro ✓ | lab_01_introduction ✓ | | lab_02_ml_systems ✓ | lab_02_compute_infra ✓ | | lab_03_ml_workflow ✓ | lab_03_communication ✓ | | lab_04_data_engr ✓ | lab_04_data_storage ✓ | | lab_05_nn_compute ✓ | lab_07_fleet_orch ✓ | | lab_06_nn_arch ✓ | lab_08_inference ✓ | | lab_07_ml_frameworks ✓ | lab_09_perf_engineering ✓ | | lab_08_model_train ✓ | lab_10_edge_intelligence ✓ | | lab_09_data_selection ✓ | lab_11_ops_scale ✓ | | lab_10_model_compress ✓ | lab_12_security_privacy ✓ | | lab_11_hw_accel ✓ | lab_13_robust_ai ✓ | | lab_12_perf_bench ✓ | lab_14_sustainable_ai ✓ | | lab_13_model_serving ✓ | lab_15_responsible_ai ✓ | | lab_14_ml_ops ✓ | lab_16_fleet_synthesis ✓ | | lab_15_responsible_engr ✓ | | | lab_16_ml_conclusion ✓ | | not touched: - `vol2/lab_05_dist_train` — already Pattern C (no changes needed) - `vol2/lab_06_fault_tolerance` — merged via #1351 - `vol1/lab_00_introduction` — its check1/check2/check3 pattern is structurally different, mechanical transformation broke engine tests, kept in the grandfather list in #1347 for manual refactor ## verification each lab passed: - `marimo check` — clean - `pytest labs/tests/test_engine.py -k <lab_name>` — cells execute, produce outputs - if any lab failed either check, the branch was reverted (that's what happened to lab_00, reverted cleanly) full repo run after all commits: - `pytest labs/tests/test_static.py` — 688 passed, 5 skipped (grandfather list + pre-existing), 1 xfailed (unrelated) - `pytest labs/tests/test_engine.py` — 70 passed ## commits 30 per-lab commits + 1 grandfather-list update. each per-lab commit is independently reviewable (small diff, typically 3-14 lines). ## related - #1347 — the tracking issue. this PR closes out 30 of 31 remaining labs; only lab_00 still open. - #1350 — the test refinement (multi-widget leak threshold with grandfather list). this PR shrinks the grandfather list to just {lab_00}. - #1351 — the proof-of-pattern PR (lab_06), landed first to validate the approach. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-27 17:26:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#8140