Add marimo MNIST + W&B Registry example#621
Conversation
Introduces the first marimo notebook in this repo. Trains a small PyTorch CNN on MNIST, logs the run with wandb, saves the trained model as an Artifact, and links it to a W&B Registry collection via the cross-org link_artifact API. The notebook is interactive: hyperparameters live in a marimo form and training is gated by an explicit Train button so slider tweaks do not trigger runs. PEP 723 inline script metadata makes it self-installing under `uvx marimo edit --sandbox`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Active voice, present tense, plain English, and consistent brand capitalization across the README and the notebook's prose cells. Code identifiers wrapped in backticks where missing; a sentence fragment in the verify step rewritten as a complete clause. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Summary
Adds the first marimo notebook to this repo at
examples/marimo/mnist-registry/. The notebook trains a small PyTorch CNN on MNIST, logs the run to W&B, saves the trained weights as a model Artifact, and links the Artifact to a W&B Registry collection through the current cross-orgrun.link_artifact(target_path="wandb-registry-model/<collection>")API.PEP 723 inline script metadata makes the notebook self-installing under
uvx marimo edit mnist_registry.py --sandbox. No new top-level deps for the repo.What the notebook demonstrates
mo.uiwidgets bind to a config dict that feedswandb.config.mo.ui.run_buttonplusmo.stopkeeps slider tweaks from kicking off runs. After a run completes, clicking again starts a new run using the current form values; the previous run finishes cleanly first.wandb.finish()runs at the top of the training cell and at the end of the notebook so re-clicking Train in the same marimo kernel never nests runs.run.link_artifact(artifact=logged, target_path=f"wandb-registry-{registry}/{collection}")with a try/except that surfaces inline remediation guidance when the Registry is not provisioned, rather than crashing.logged.wait()before linking prevents a race wherelink_artifactresolves an uncommitted version.wandb.define_metricusesepochas the x-axis fortrain/*andtest/*series in the W&B UI.Architecture and training loop mirror
examples/pytorch/pytorch-cnn-mnist/main.py. Registry linking mirrorscolabs/wandb_registry/zoo_wandb.ipynb.Files
examples/marimo/mnist-registry/mnist_registry.py— the notebook (~640 lines)examples/marimo/mnist-registry/README.md— prereqs, how to run, design notesexamples/marimo/mnist-registry/requirements.txt— pip mirror of the PEP 723 blockCommits
add marimo MNIST + W&B Registry example— initial draftapply Google Developer Style Guide pass to marimo MNIST example— style cleanup (active voice, present tense, plain English, brand capitalization, code identifiers in backticks)Test plan
python3 -c "import ast; ast.parse(open('examples/marimo/mnist-registry/mnist_registry.py').read())"succeeds (verified locally).uvx marimo edit examples/marimo/mnist-registry/mnist_registry.py --sandboxopens the notebook with all cells rendering and no errors.mnist-cnn-<run-id>appears under the run's Artifacts tab with metadata for test accuracy, parameter count, and hyperparameters.wandb-registry-model/MNIST Classifiers; the version appears in the Model registry UI.wandb.initwarnings about a pre-existing run).mo.calloutwith remediation guidance and does not crash the notebook.🤖 Generated with Claude Code