repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
cs249r_book | labs/mlsysbook_labs/track_arcs.py | .py | """Volume-level track arcs for the MLSysBook labs.
The arc registry gives each canonical track a durable narrative across Volume I
and Volume II while keeping individual labs standalone. Lab notebooks should
render concise arc context from this module instead of hand-authoring separate
journey text in every file.
"""
... | 307 | 17,262 |
cs249r_book | labs/mlsysbook_labs/workflow.py | .py | """Workflow constraint-tax helpers for track-aware ML lifecycle labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class WorkflowGate:
gate_id: str
label: str
stage: int... | 275 | 9,994 |
cs249r_book | labs/mlsysbook_labs/reports.py | .py | """Report builders for submit-ready MLSysBook lab artifacts."""
from __future__ import annotations
import json
import html
from dataclasses import asdict
from typing import Any
from .schemas import ChapterRecap, LabMetadata, LabReport, to_plain
def _bullet_dict(values: dict[str, Any]) -> str:
if not values:
... | 299 | 9,014 |
cs249r_book | labs/mlsysbook_labs/catalog.py | .py | """Versioned catalog for the MLSysBook interactive labs."""
from __future__ import annotations
from .schemas import LabMetadata
UPDATED_AT = "2026-06-02"
LAB_CATALOG: dict[str, LabMetadata] = {
"vol1/lab_00_introduction.py": LabMetadata(
lab_id="v1_00_architects_portal",
title="The Architect's... | 291 | 10,103 |
cs249r_book | labs/mlsysbook_labs/inference.py | .py | """Shared inference-economy helpers for track-aware serving labs."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
SECONDS_PER_DAY = 86_400
@dataclass(frozen=True)
class InferenceEconomyProfile:
track... | 285 | 9,645 |
cs249r_book | labs/mlsysbook_labs/selection.py | .py | """Data-selection helpers for track-aware quality, coverage, and cost labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class CoverageSubgroup:
subgroup_id: str
label: str
... | 413 | 14,814 |
cs249r_book | labs/mlsysbook_labs/system_design.py | .py | """Reusable track-aware system-design helpers for remaining Volume II labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class SystemDesignOption:
option_id: str
label: str
... | 973 | 38,201 |
cs249r_book | labs/mlsysbook_labs/triad.py | .py | """Data-Algorithm-Machine triad helpers for track-aware diagnosis labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class TriadTrackProfile:
track_id: str
label: str
hardware_re... | 204 | 7,460 |
cs249r_book | labs/mlsysbook_labs/neural_compute.py | .py | """Neural-compute helpers for track-aware activation and operator labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class OperatorDesignOption:
design_id: str
label: str
... | 334 | 12,508 |
cs249r_book | labs/mlsysbook_labs/state.py | .py | """Design ledger compatibility exports."""
from mlsysim.labs.state import DesignLedger, LedgerState
__all__ = ["DesignLedger", "LedgerState"]
| 6 | 144 |
cs249r_book | labs/mlsysbook_labs/architecture.py | .py | """Architecture-family helpers for track-aware architecture choice labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class ArchitectureCandidate:
architecture_id: str
label... | 414 | 15,842 |
cs249r_book | labs/mlsysbook_labs/tracks.py | .py | """Canonical student track profiles for track-aware MLSysBook labs."""
from __future__ import annotations
from .schemas import TrackProfile
DEFAULT_TRACK_ID = "iphone"
TRACK_EMOJIS: dict[str, str] = {
"iphone": "📱",
"oura_ring": "💍",
"robotaxi": "🚕",
"cloud_fleet": "☁️",
}
CANONICAL_TRACKS: t... | 155 | 5,805 |
cs249r_book | labs/mlsysbook_labs/edge.py | .py | """Shared edge-placement helpers for track-aware MLSysBook labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class EdgeDeviceProfile:
track_id: str
label: str
category: str
... | 372 | 12,188 |
cs249r_book | labs/mlsysbook_labs/variants.py | .py | """Typed track-specific lab scenario variants."""
from __future__ import annotations
from .catalog import LAB_CATALOG
from .schemas import LabTrackVariant, TrackProfile
from .tracks import CANONICAL_TRACKS, get_track_profile, normalize_track_id
PILOT_LAB_IDS = (
"v1_00_architects_portal",
"v1_01_ai_triad",
... | 4,054 | 224,163 |
cs249r_book | labs/mlsysbook_labs/frameworks.py | .py | """Framework and runtime helpers for track-aware deployment labs."""
from __future__ import annotations
from dataclasses import dataclass
from math import ceil
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class RuntimeOption:
runtime_id: str
lab... | 391 | 14,477 |
cs249r_book | labs/mlsysbook_labs/capstone.py | .py | """Capstone helpers for track-aware architecture audits."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class CapstoneTrackProfile:
track_id: str
label: str
hardware_ref: ... | 313 | 10,607 |
cs249r_book | labs/mlsysbook_labs/__init__.py | .py | """Shared helpers for MLSysBook interactive trade-off labs."""
from .legacy_components import (
Card,
ComparisonRow,
DecisionLog,
FailureBanner,
LatencyWaterfall,
MathPeek,
MetricRow,
PredictionLock,
RooflineVisualizer,
StakeholderMessage,
)
from .catalog import LAB_CATALOG, get... | 601 | 14,472 |
cs249r_book | labs/mlsysbook_labs/ops.py | .py | """Shared ML-operations helpers for track-aware degradation labs."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class OpsTrackProfile:
track_id: str
label: str
hardwar... | 320 | 11,087 |
cs249r_book | labs/mlsysbook_labs/training.py | .py | """Training-feasibility helpers for track-aware training labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class TrainingStrategyOption:
strategy_id: str
label: str
tra... | 413 | 14,886 |
cs249r_book | labs/mlsysbook_labs/responsibility.py | .py | """Responsible-engineering helpers for track-aware lab scenarios."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class ResponsibilityTrackProfile:
track_id: str
label: str
... | 431 | 15,634 |
cs249r_book | labs/mlsysbook_labs/deployment.py | .py | """Deployment-envelope helpers for track-aware physics labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class PlacementOption:
placement_id: str
label: str
network_lat... | 394 | 15,001 |
cs249r_book | labs/mlsysbook_labs/registry_refs.py | .py | """Helpers for resolving MLSysIM registry reference strings."""
from __future__ import annotations
from typing import Any
_ALLOWED_ROOTS = frozenset({"Hardware", "Models", "Systems", "Infrastructure"})
def resolve_mlsysim_ref(ref: str) -> Any:
"""Resolve a canonical MLSysIM registry string such as `Hardware.C... | 33 | 1,023 |
cs249r_book | labs/mlsysbook_labs/ui.py | .py | """Reusable Marimo UI components for the MLSysBook trade-off labs."""
from __future__ import annotations
import html
from dataclasses import asdict
from typing import Any, Mapping
import marimo as mo
from .schemas import ChapterRecap, InstructorMetadata, LabMetadata, NuggetSpec, TrackProfile
from .tracks import DEF... | 1,205 | 38,521 |
cs249r_book | labs/mlsysbook_labs/style.py | .py | """Style compatibility exports plus the new academic lab CSS."""
from mlsysim.labs.style import COLORS, LAB_CSS, apply_plotly_theme, confidence_widget, concept_section_header, progress_bar
from .ui import ACADEMIC_LAB_CSS
__all__ = [
"COLORS",
"LAB_CSS",
"ACADEMIC_LAB_CSS",
"apply_plotly_theme",
... | 16 | 393 |
cs249r_book | labs/mlsysbook_labs/legacy_components.py | .py | """Legacy component compatibility exports."""
from mlsysim.labs.components import (
Card,
ComparisonRow,
DecisionLog,
FailureBanner,
LatencyWaterfall,
MathPeek,
MetricRow,
PredictionLock,
RooflineVisualizer,
StakeholderMessage,
)
__all__ = [
"Card",
"ComparisonRow",
... | 28 | 490 |
cs249r_book | labs/mlsysbook_labs/benchmarking.py | .py | """Shared benchmarking-trap helpers for track-aware labs."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class BenchmarkTrackProfile:
track_id: str
label: str
... | 239 | 7,887 |
cs249r_book | labs/mlsysbook_labs/schemas.py | .py | """Typed metadata contracts for MLSysBook interactive labs."""
from __future__ import annotations
from dataclasses import asdict, dataclass, field, is_dataclass
from datetime import datetime, timezone
from typing import Any, Mapping
from .versions import LEDGER_SCHEMA_VERSION, MLSYSBOOK_LABS_VERSION, REPORT_SCHEMA_V... | 174 | 4,883 |
cs249r_book | labs/mlsysbook_labs/data_pipeline.py | .py | """Data-pipeline helpers for track-aware data gravity labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any, Mapping
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class DataMovementStrategy:
strategy_id: str
label: str
data_red... | 321 | 11,488 |
cs249r_book | labs/mlsysbook_labs/versions.py | .py | """Version constants for the MLSysBook lab helper package."""
MLSYSBOOK_LABS_VERSION = "0.1.0"
REPORT_SCHEMA_VERSION = "1.0"
LEDGER_SCHEMA_VERSION = "1.0"
STABLE_RELEASE_CHANNEL = "dev"
| 7 | 187 |
cs249r_book | labs/mlsysbook_labs/roofline.py | .py | """Shared roofline helpers for track-aware hardware acceleration labs."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class RooflineHardwareProfile:
track_id: str
label: str
hardwa... | 162 | 5,146 |
cs249r_book | labs/mlsysbook_labs/serving.py | .py | """Shared model-serving helpers for track-aware tail-latency labs."""
from __future__ import annotations
import math
from dataclasses import dataclass
from typing import Any
from .schemas import LabTrackVariant, TrackProfile
@dataclass(frozen=True)
class ServingTrackProfile:
track_id: str
label: str
ha... | 441 | 15,150 |
cs249r_book | labs/mlsysbook_labs/migration.py | .py | """Compact helpers for migrating legacy notebooks to the track/report contract."""
from __future__ import annotations
from typing import Any, Mapping
from .reports import build_lab_report, report_export_panel
from .schemas import LabMetadata, LabReport, LabTrackVariant, TrackProfile
from .ui import big_takeaways as ... | 170 | 6,871 |
cs249r_book | labs/tools/interaction_lab_smoke.py | .py | #!/usr/bin/env python3
"""Deep browser interaction smoke checks for MLSysBook lab pages.
This tool starts each Marimo lab, loads it in Chromium, scrolls through the
rendered page, switches canonical tracks, opens visible tabs, clicks safe radio
controls, checks for runtime/layout failures, and writes screenshots plus ... | 1,409 | 52,738 |
cs249r_book | labs/tools/fix_protocol_compliance.py | .py | #!/usr/bin/env python3
"""
Fix protocol compliance issues across all labs.
Handles:
1. Add ZONE comments where missing
2. Add ledger.save() where missing
3. Add mo.stop() gates where missing
Usage:
python3 labs/tools/fix_protocol_compliance.py --dry-run # Preview changes
python3 labs/tools/fix_protocol_complian... | 310 | 9,569 |
cs249r_book | labs/tools/render_lab_smoke.py | .py | #!/usr/bin/env python3
"""Browser render smoke checks for Marimo lab apps.
This tool is intentionally separate from the default pytest suite. It starts
read-only Marimo servers, opens each lab in Chromium, clicks through the
canonical tracks, checks for common browser/runtime failures, and writes
screenshots to a loca... | 215 | 7,207 |
cs249r_book | labs/tools/capture_landing_shots.py | .py | """Capture Playwright screenshots of the labs landing page for review."""
import http.server
import os
import socketserver
import threading
import time
from pathlib import Path
from playwright.sync_api import sync_playwright
LABS_ROOT = Path(__file__).resolve().parents[1]
BUILD_DIR = LABS_ROOT / "_build"
SHOT_DIR = ... | 105 | 3,301 |
cs249r_book | labs/vol2/lab_01_introduction.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import marimo as mo
import sys
import math
from pathlib import Path
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic", "pint", "plotly", "pandas"], ... | 1,350 | 55,465 |
cs249r_book | labs/vol2/lab_05_dist_train.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import html as html_lib
import math
import sys
from pathlib import Path
import marimo as mo
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic",... | 1,715 | 73,001 |
cs249r_book | labs/vol2/lab_11_edge_intelligence.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ─────────────────────────────────────────────────────────────────────────────
# LAB V2-11: THE EDGE THERMODYNAMICS LAB
#
# Volume II, Chapter: Edge Intelligence (edge_intelligence.qmd)
#
# Four Parts (~55 minutes):
# Part A — On-Device Limit... | 2,033 | 98,041 |
cs249r_book | labs/vol2/lab_15_sustainable_ai.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-15: THE CARBON BUDGET
#
# Chapter invariant: sustainable AI is an amount system. Energy, carbon
# intensity, utilization, embodied carbon, quality, latency,... | 1,792 | 79,700 |
cs249r_book | labs/vol2/lab_14_robust_ai.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-14: THE ROBUSTNESS BUDGET
#
# Chapter invariant: robustness is an amount system. A deployed model buys
# bounded behavior under shift by spending finite str... | 2,197 | 97,245 |
cs249r_book | labs/vol2/lab_08_fleet_orch.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import marimo as mo
import sys
import math
import html as html_lib
from pathlib import Path
import numpy as np
if sys.platform == "emscripten":
import micropip
await micropip... | 1,713 | 76,280 |
cs249r_book | labs/vol2/lab_12_ops_scale.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-12: OPERATIONS AT SCALE AS CONTROL LOOPS
#
# Chapter invariant: operations at scale are control loops. SLOs, canaries,
# rollouts, incidents, and blast radi... | 1,794 | 73,503 |
cs249r_book | labs/vol2/lab_03_communication.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import html as html_lib
import sys
from pathlib import Path
import marimo as mo
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic", "pint", "plotly... | 1,648 | 69,191 |
cs249r_book | labs/vol2/lab_17_fleet_synthesis.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-17: THE FLEET SYNTHESIS
#
# Chapter invariant: the fleet, not the model, is the object of engineering.
# A defensible deployment review follows the binding ... | 2,045 | 87,208 |
cs249r_book | labs/vol2/lab_16_responsible_ai.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import html
import math
import ... | 1,764 | 76,653 |
cs249r_book | labs/vol2/lab_04_data_storage.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import marimo as mo
import sys
from pathlib import Path
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic", "pint", "plotly", "pandas"], keep_going=False... | 1,895 | 80,605 |
cs249r_book | labs/vol2/lab_13_security_privacy.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-13: THE PRICE OF PRIVACY
#
# Chapter invariant: security and privacy are amount systems. Threat surface,
# privacy budget, control overhead, access/deletion... | 1,836 | 80,193 |
cs249r_book | labs/vol2/lab_09_perf_engineering.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-09: THE OPTIMIZATION TRAP
#
# Chapter invariant: optimization is measurement-driven. The same Part A/B/C/D
# concept sequence is realized by each track thr... | 1,603 | 71,883 |
cs249r_book | labs/vol2/lab_02_compute_infra.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import marimo as mo
import sys
from pathlib import Path
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic", "pint", "plotly", "pandas"], keep_going=Fals... | 1,618 | 69,869 |
cs249r_book | labs/vol2/lab_10_inference.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# -----------------------------------------------------------------------------
# LAB V2-10: THE INFERENCE ECONOMY
#
# Chapter invariant: production inference is a coupled queueing, memory/state,
# and economics problem. Mean throughput does not... | 2,220 | 99,225 |
cs249r_book | labs/vol2/lab_06_collective_communication.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import html as html_lib
import sys
from pathlib import Path
import marimo as mo
import numpy as np
if sys.platform == "emscripten":
import micropip
await micropip.install(["pyd... | 1,565 | 67,700 |
cs249r_book | labs/vol2/lab_07_fault_tolerance.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
@app.cell
async def _():
import marimo as mo
import html as html_lib
import math
import sys
from pathlib import Path
if sys.platform == "emscripten":
import micropip
await micropip.install(["pydantic", "... | 1,503 | 64,949 |
cs249r_book | labs/vol1/lab_02_ml_systems.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import html
... | 1,675 | 66,500 |
cs249r_book | labs/vol1/lab_06_nn_arch.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: SETUP
# ===========================================================================
@app.cell
async def _():
import html
import marimo as mo
im... | 1,722 | 73,201 |
cs249r_book | labs/vol1/lab_16_ml_conclusion.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,636 | 73,612 |
cs249r_book | labs/vol1/lab_03_ml_workflow.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,324 | 56,394 |
cs249r_book | labs/vol1/lab_01_ml_intro.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,551 | 69,736 |
cs249r_book | labs/vol1/lab_12_perf_bench.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# CELL 0: SETUP
@app.cell
async def _():
import marimo as mo
import sys
import math
from pathlib import Path
import numpy as np
if sys.platform == "emscripten":
import micropip
await micropip.install(["... | 1,592 | 68,637 |
cs249r_book | labs/vol1/lab_08_model_train.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: SETUP
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
fro... | 1,437 | 61,839 |
cs249r_book | labs/vol1/lab_07_ml_frameworks.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: SETUP
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
fro... | 1,519 | 67,252 |
cs249r_book | labs/vol1/lab_05_nn_compute.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,691 | 70,541 |
cs249r_book | labs/vol1/lab_15_responsible_engr.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,665 | 73,692 |
cs249r_book | labs/vol1/lab_10_model_compress.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import sys
from pathlib import Path... | 2,046 | 80,212 |
cs249r_book | labs/vol1/lab_04_data_engr.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
f... | 1,811 | 78,015 |
cs249r_book | labs/vol1/lab_09_data_selection.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: SETUP
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
fro... | 1,834 | 75,753 |
cs249r_book | labs/vol1/lab_00_introduction.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ─────────────────────────────────────────────────────────────────────────────
# LAB 00: THE ARCHITECT'S PORTAL
#
# This is an ML Systems lab — not an ML lab.
# Students are not here to learn how models work.
# They are here to understand that ... | 1,615 | 73,236 |
cs249r_book | labs/vol1/lab_11_hw_accel.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# CELL 0: SETUP
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
im... | 1,641 | 70,358 |
cs249r_book | labs/vol1/lab_13_model_serving.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
i... | 1,881 | 81,022 |
cs249r_book | labs/vol1/lab_14_ml_ops.py | .py | import marimo
__generated_with = "0.23.1"
app = marimo.App(width="full")
# ===========================================================================
# ZONE A: OPENING
# ===========================================================================
@app.cell
async def _():
import marimo as mo
import sys
i... | 1,619 | 71,054 |
cs249r_book | labs/tests/test_serving_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
batching_tax,
cache_capacity,
cold_start_latency,
get_lab_track_variant,
get_track_profile,
queueing_latency,
resolve_mlsysim_ref,
serving_track_profile,
)
def _profile(track_id: str):
track = get_track_profile(track_... | 93 | 2,552 |
cs249r_book | labs/tests/test_inference_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
batching_result,
cost_crossover,
get_lab_track_variant,
get_track_profile,
inference_economy_profile,
resolve_mlsysim_ref,
serving_plan,
state_capacity,
)
def _profile(track_id: str):
track = get_track_profile(track_i... | 86 | 2,600 |
cs249r_book | labs/tests/test_roofline_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
fusion_traffic,
gemm_workload,
get_lab_track_variant,
get_track_profile,
hardware_roofline_profile,
resolve_mlsysim_ref,
roofline_point,
)
def _roofline_profile(track_id: str):
profile = get_track_profile(track_id)
va... | 60 | 1,980 |
cs249r_book | labs/tests/test_architecture_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
architecture_decision,
architecture_scaling_curve,
architecture_signature,
architecture_track_profile,
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
)
def _profile(track_id: str):
track = get_track_profil... | 79 | 2,834 |
cs249r_book | labs/tests/test_ui_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
COMPLETION_STATES,
big_takeaways,
checkpoint_card,
constraint_check,
decision_flow,
evidence_summary,
lab_map,
learning_objectives,
part_header,
scenario_slice,
scenario_thread,
track_selector,
track_arc... | 180 | 5,591 |
cs249r_book | labs/tests/test_registry_refs.py | .py | from __future__ import annotations
import pytest
from mlsysbook_labs import resolve_mlsysim_ref
def test_resolve_mlsysim_model_and_hardware_refs():
model = resolve_mlsysim_ref("Models.Tiny.DS_CNN")
hardware = resolve_mlsysim_ref("Hardware.Tiny.OuraRing")
assert model.name == "DS-CNN (KWS)"
assert h... | 30 | 885 |
cs249r_book | labs/tests/test_track_profiles.py | .py | from __future__ import annotations
from pathlib import Path
from mlsysbook_labs import (
CANONICAL_TRACKS,
LabMetadata,
build_lab_report,
get_track_profile,
normalize_track_id,
report_text_fallback,
track_display_label,
track_emoji,
track_options,
track_profile_map,
)
REPO_RO... | 123 | 4,248 |
cs249r_book | labs/tests/test_report_contract.py | .py | from __future__ import annotations
import ast
from pathlib import Path
from mlsysbook_labs import (
LAB_CATALOG,
build_lab_report,
canonical_track_ids,
get_lab_track_variant,
get_track_profile,
variant_source_trace,
)
REPO_ROOT = Path(__file__).resolve().parents[2]
LABS_ROOT = REPO_ROOT / "l... | 205 | 7,038 |
cs249r_book | labs/tests/test_engine.py | .py | """
Level 2: Engine Execution Tests
================================
Runs each lab's cells headlessly via marimo.App.run() to verify:
- All cells execute without exceptions
- mlsysim Engine.solve() calls produce valid results
- Key computed values are within expected ranges
These tests are slower (~2-5 sec per ... | 130 | 4,609 |
cs249r_book | labs/tests/test_protocol.py | .py | """
Level 4: Protocol Invariant Tests
==================================
Validates that each lab complies with the 6 Protocol Invariants
defined in the project labs protocol doc.
These are structural quality gates — they verify pedagogical
completeness rather than runtime correctness.
Invariant 1: Every Number Has a... | 375 | 15,829 |
cs249r_book | labs/tests/test_capstone_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
architecture_memo,
capstone_track_profile,
get_lab_track_variant,
get_track_profile,
replay_ledger,
resolve_mlsysim_ref,
sensitivity_audit,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
variant = ... | 80 | 2,545 |
cs249r_book | labs/tests/test_training_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
training_frontier,
training_memory_stack,
training_plan,
training_track_profile,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
varian... | 70 | 2,871 |
cs249r_book | labs/tests/test_deployment_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
deployment_mitigation,
deployment_track_profile,
evaluate_deployment_envelope,
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
sweep_deployment_knob,
)
def _profile(track_id: str):
track = get_track_profile... | 78 | 2,706 |
cs249r_book | labs/tests/test_responsibility_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
carbon_budget,
explanation_overhead,
get_lab_track_variant,
get_track_profile,
metric_conflict,
resolve_mlsysim_ref,
responsibility_budget,
responsibility_track_profile,
)
def _profile(track_id: str):
track = get_trac... | 95 | 2,866 |
cs249r_book | labs/tests/test_migration_shell.py | .py | from __future__ import annotations
from mlsysbook_labs import (
baseline_big_takeaways,
baseline_learning_objectives,
build_migration_report,
get_lab_metadata,
get_lab_track_variant,
get_track_profile,
variant_source_trace,
)
def test_baseline_copy_uses_metadata_and_variant_metrics():
... | 60 | 2,314 |
cs249r_book | labs/tests/test_triad_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
diagnose_triad,
get_lab_track_variant,
get_track_profile,
intervention_frontier,
resolve_mlsysim_ref,
triad_track_profile,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
variant = get_lab_track_variant... | 61 | 1,803 |
cs249r_book | labs/tests/test_framework_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
compile_break_even,
dispatch_stack,
framework_track_profile,
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
runtime_decision,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
variant ... | 72 | 2,722 |
cs249r_book | labs/tests/test_benchmarking_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
amdahl_speedup,
benchmark_track_profile,
get_lab_track_variant,
get_track_profile,
metric_gate,
resolve_mlsysim_ref,
sustained_benchmark,
tail_latency,
)
def _profile(track_id: str):
track = get_track_profile(track_id... | 80 | 2,085 |
cs249r_book | labs/tests/test_lab_variants.py | .py | from __future__ import annotations
from mlsysbook_labs import (
ALL_LAB_IDS,
LAB_CATALOG,
PILOT_LAB_IDS,
canonical_track_ids,
get_lab_track_variant,
get_track_profile,
list_lab_variants,
resolve_mlsysim_ref,
variant_coverage,
)
def _resolve_ref(ref: str):
return resolve_mlsysi... | 454 | 21,278 |
cs249r_book | labs/tests/browser_smoke.py | .py | """
Level 5: Browser-level WASM Smoke Test
=======================================
Launches a real headless Chromium via Playwright against WASM-exported labs
served behind the cross-origin isolation headers Pyodide + SharedArrayBuffer
require. Validates that:
- Pyodide actually initializes in a real browser (not j... | 276 | 10,819 |
cs249r_book | labs/tests/test_edge_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
adaptation_storage,
edge_device_profile,
energy_drain,
federated_communication,
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
training_memory_breakdown,
)
def _edge_profile(track_id: str):
profile = g... | 82 | 2,716 |
cs249r_book | labs/tests/test_selection_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
coverage_profile,
data_policy_decision,
data_selection_profile,
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
selection_frontier,
selection_utility,
)
def _profile(track_id: str):
track = get_track_pr... | 71 | 2,753 |
cs249r_book | labs/tests/test_widget.py | .py | """
Level 3: Widget Interaction Tests
==================================
Simulates student interactions with prediction widgets by overriding
cell definitions via app.run(defs={...}).
These tests verify:
- Prediction radio buttons accept valid selections
- Number inputs work within slider ranges
- The app doesn... | 288 | 12,673 |
cs249r_book | labs/tests/test_wasm_persistence.py | .py | """
Real-browser regression test for DesignLedger's WASM/IndexedDB persistence
(mlsysim/mlsysim/labs/state.py).
Why this exists
----------------
#1985 was a fire-and-forget asyncio.create_task() bug in DesignLedger.save()
that swallowed IndexedDB failures silently. PR #1988 fixed that -- but
review of #1988 caught a *... | 208 | 7,464 |
cs249r_book | labs/tests/test_ops_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
debt_cascade,
drift_visibility,
get_lab_track_variant,
get_track_profile,
ops_policy,
ops_track_profile,
resolve_mlsysim_ref,
retraining_cadence,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
... | 75 | 2,107 |
cs249r_book | labs/tests/test_track_arcs.py | .py | from __future__ import annotations
from mlsysbook_labs import (
ALL_LAB_IDS,
CANONICAL_TRACKS,
get_lab_arc_step,
get_lab_track_variant,
list_lab_arc_steps,
list_lab_variants,
list_track_arcs,
track_arc_context_summary,
validate_track_arcs,
)
def test_track_arc_registry_matches_cat... | 78 | 3,070 |
cs249r_book | labs/tests/test_system_design_helpers.py | .py | from __future__ import annotations
from pathlib import Path
from mlsysbook_labs import (
get_lab_track_variant,
get_track_profile,
resolve_mlsysim_ref,
system_curve,
system_decision,
system_design_ledger_summary,
system_design_profile,
system_frontier,
)
REPO_ROOT = Path(__file__).re... | 130 | 4,919 |
cs249r_book | labs/tests/test_neural_compute_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
get_lab_track_variant,
get_track_profile,
memory_cliff,
neural_compute_profile,
operation_ledger,
operator_design,
resolve_mlsysim_ref,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
variant = get_... | 66 | 2,335 |
cs249r_book | labs/tests/test_static.py | .py | """
Level 1: Static Analysis Tests
===============================
Fast checks that don't execute any code. Safe for CI on every push.
Tests:
- AST syntax validity
- Marimo structure (import marimo, app = marimo.App, @app.cell)
- WASM bootstrap presence
- Required imports (mlsysim, plotly, DesignLedger)
- N... | 773 | 33,314 |
cs249r_book | labs/tests/test_data_pipeline_helpers.py | .py | from __future__ import annotations
from mlsysbook_labs import (
data_pipeline_profile,
evaluate_pipeline,
get_lab_track_variant,
get_track_profile,
movement_frontier,
pipeline_architecture,
resolve_mlsysim_ref,
)
def _profile(track_id: str):
track = get_track_profile(track_id)
var... | 76 | 2,904 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.