uploaded first notebooks from notebook competition#59
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new JAM 2026 Q2 competition notebooks to the gallery and links them from the top-level README.
Changes:
- Add
inscribed-squares.pymarimo notebook (diffusion → inscribed squares walkthrough) with remote.npzgallery loading. - Add
geometry-of-noise.pymarimo notebook (closed-form diffusion geometry demo with Pyodide widgets). - Update
README.mdto include new MoLab links for the added notebooks (anddead-salmon.py).
Reviewed changes
Copilot reviewed 3 out of 7 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| notebooks/jam-2026-Q2/inscribed-squares.py | New notebook demonstrating inscribed-square diffusion results, including gallery loading + interactive visuals. |
| notebooks/jam-2026-Q2/geometry-of-noise.py | New notebook implementing interactive Pyodide widgets to explain diffusion “blindness” analytically. |
| README.md | Adds entries linking to the new notebooks in MoLab. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from pathlib import Path as _Path | ||
|
|
||
| # Prefer the PNG on disk; fall back to the base64-encoded text file if | ||
| # the image asset isn't shipped alongside the notebook (e.g., in molab). | ||
| _src = None | ||
| try: | ||
| _dir = _Path(__file__).parent / "figures" | ||
| _png = _dir / "cifar10_comparison.png" | ||
| _txt = _dir / "cifar10_comparison_b64.txt" | ||
| if _png.exists(): | ||
| _src = _png | ||
| elif _txt.exists(): | ||
| _src = f"data:image/png;base64,{_txt.read_text().strip()}" | ||
| except (NameError, OSError): | ||
| _src = None | ||
|
|
||
| if _src is not None: | ||
| _figure = mo.image(src=_src, width="100%", rounded=True) | ||
| else: | ||
| _figure = mo.md("*(CIFAR-10 figure not found)*") | ||
|
|
||
| mo.vstack([ | ||
| _figure, | ||
| mo.md( |
There was a problem hiding this comment.
This section attempts to load notebooks/jam-2026-Q2/figures/cifar10_comparison.png (or the _b64.txt fallback), but there is no figures/ directory committed alongside this notebook. As a result, the notebook will always render "(CIFAR-10 figure not found)". Either commit the referenced figure asset(s) under notebooks/jam-2026-Q2/figures/ or remove/update this cell so it doesn't reference missing files.
| from pathlib import Path as _Path | |
| # Prefer the PNG on disk; fall back to the base64-encoded text file if | |
| # the image asset isn't shipped alongside the notebook (e.g., in molab). | |
| _src = None | |
| try: | |
| _dir = _Path(__file__).parent / "figures" | |
| _png = _dir / "cifar10_comparison.png" | |
| _txt = _dir / "cifar10_comparison_b64.txt" | |
| if _png.exists(): | |
| _src = _png | |
| elif _txt.exists(): | |
| _src = f"data:image/png;base64,{_txt.read_text().strip()}" | |
| except (NameError, OSError): | |
| _src = None | |
| if _src is not None: | |
| _figure = mo.image(src=_src, width="100%", rounded=True) | |
| else: | |
| _figure = mo.md("*(CIFAR-10 figure not found)*") | |
| mo.vstack([ | |
| _figure, | |
| mo.md( | |
| mo.vstack([ | |
| mo.md( | |
| "> **CIFAR-10 comparison (summary)**\n>\n" | |
| "> The original notebook version referenced an external figure here.\n" | |
| "> In this checked-in script we keep the section self-contained and\n" | |
| "> summarize the result directly: blind **noise prediction** produces\n" | |
| "> visibly degraded samples, while blind **velocity prediction**\n" | |
| "> remains clean and stable." | |
| ), | |
| mo.md( |
| # "matplotlib", | ||
| # "scipy", | ||
| # "scikit-image", | ||
| # "pillow", |
There was a problem hiding this comment.
pillow is listed as a dependency, but this notebook doesn't import or use it. Dropping unused dependencies reduces install time and package size (especially in Pyodide).
| # "pillow", |
| GH_RAW = "https://raw.githubusercontent.com/FarseenSh/alphaxiv-marimo-comp/main/data/gallery.npz" | ||
|
|
||
| def _fetch_remote(): | ||
| with urllib.request.urlopen(GH_RAW) as _r: | ||
| return dict(np.load(io.BytesIO(_r.read()))) | ||
|
|
There was a problem hiding this comment.
GH_RAW points at the main branch of an external repository. This makes the notebook non-reproducible and fragile (a force-push or file change upstream can break it). Prefer pinning to an immutable commit SHA / release tag URL, or vendoring the .npz into this repository (and loading locally first) to avoid network/upstream availability issues.
| Diffusion sampling itself runs offline (~5s per sample on CPU). The | ||
| notebook reads the cached samples from a 10 MB `.npz`. *Why?* PyTorch | ||
| is not in Pyodide, but everything else here is. To reproduce the | ||
| sampling, see `scripts/precompute.py` in the repo. |
There was a problem hiding this comment.
The markdown says "see scripts/precompute.py in the repo", but this repository doesn't have scripts/precompute.py. This is likely a stale reference to another repo; update the reference to the correct path in this repo (or add the script) so readers can actually reproduce the precomputation steps.
| sampling, see `scripts/precompute.py` in the repo. | |
| sampling, run the offline precomputation from the project source used to | |
| generate the cached `.npz` file in this notebook. |
|
|
||
| import numpy as np | ||
| import plotly.graph_objects as go | ||
| import traitlets | ||
| from pywidget import PyWidget | ||
|
|
There was a problem hiding this comment.
plotly is imported here but never used in the notebook (and it also appears in the script metadata dependencies). This adds unnecessary dependency weight for Pyodide/MoLab and can cause install failures if Plotly isn't available. Remove the plotly.graph_objects import and drop Plotly from the # dependencies list unless it's going to be used.
|
Thank you! |
There's probably more, but these stood out and these are stand-alone.