Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
edf81cd
Edit mixed feedforward and recurrent population networks in Studio
houman1359 Nov 19, 2026
fee3424
Open Studio in a personal Binder training session
houman1359 Nov 20, 2026
fbc8326
Register the Studio launcher with the personal Jupyter server
houman1359 Nov 20, 2026
f024ab4
Pin the online Studio link to the verified public session
houman1359 Nov 20, 2026
bafacdf
Show depth response times and add incoming sources in Studio
houman1359 Nov 20, 2026
979a845
Add depth-specific signal travel delays to population networks and St…
houman1359 Nov 20, 2026
4a81db2
Open the depth-delay Studio preview from the guides
houman1359 Nov 20, 2026
eab897f
Skip unused delay history and verify branched sparse projections
houman1359 Nov 20, 2026
d5f543e
Keep Studio wiring edits ordered and validate receiving populations
houman1359 Nov 20, 2026
cd4e83f
Point the public Studio preview to the reviewed wiring editor
houman1359 Nov 20, 2026
4a40bff
Prepare installation and publishing guides for core 0.6 and Studio 0.2
houman1359 Nov 20, 2026
d7e66d5
Preserve Studio contact edits and validate sources at each depth
houman1359 Nov 20, 2026
d650fa6
Update the public Studio preview to the corrected depth editor
houman1359 Nov 20, 2026
9d1500e
Export and copy the current Studio design during validation
houman1359 Nov 20, 2026
38652fc
Pin the Studio preview to the verified YAML export
houman1359 Nov 20, 2026
94ee48d
Add the contextual EMNIST task to Studio templates
houman1359 Nov 20, 2026
055022f
Point the Studio preview to the contextual template
houman1359 Nov 20, 2026
156b6ee
Preserve Studio edits across validation and model actions
houman1359 Nov 20, 2026
1397a29
Point the Studio preview at the verified editor fixes
houman1359 Nov 20, 2026
5c199a3
Let validated Studio edits repair readouts and population wiring
houman1359 Nov 20, 2026
c7cc7c5
Document GPU training from a cluster Studio session
houman1359 Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .binder/dendrinet_binder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""Open the local Studio belonging to this personal Jupyter server."""

import threading
from pathlib import Path

from jupyter_server.auth.decorator import authorized
from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.extension.application import ExtensionApp
from jupyter_server.utils import url_path_join
from tornado import web


class OpenStudio(JupyterHandler):
def initialize(self, studio):
self.studio = studio

@web.authenticated
@authorized(action="execute", resource="kernels")
def get(self):
server = self.studio.start_for(self.request.host_name)
# The fragment reaches the editor. It is never sent to the proxy as a query.
base = url_path_join(self.base_url, "proxy", str(server.server_port))
self.set_header("Cache-Control", "no-store")
self.set_header("Referrer-Policy", "no-referrer")
self.redirect(f"{base}/#{server.studio_token}")


class StudioSession(ExtensionApp):
name = "dendrinet_binder"
server = None

def initialize_handlers(self):
self.handlers.append((r"/open-studio/?", OpenStudio, {"studio": self}))

def start_for(self, host):
if self.server is None:
from dendrinet_studio.server import make_server

root = Path(self.serverapp.root_dir) / "studio-runs"
self.server = make_server(root, port=0, threads=1, allowed_hosts=(host,))
threading.Thread(target=self.server.serve_forever, daemon=True).start()
return self.server

async def stop_extension(self):
if self.server is not None:
self.server.studio_runs.close()
self.server.shutdown()
self.server.server_close()


def _jupyter_server_extension_points():
return [{"module": __name__, "app": StudioSession}]
9 changes: 9 additions & 0 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: dendrinet-studio
channels:
- conda-forge
dependencies:
- python=3.11
- pip
- jupyter_server>=2,<3
- pip:
- jupyter-server-proxy==4.6.1
8 changes: 8 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

# Install CPU wheels before resolving the two packages from the selected Git revision.
python -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.9.1 torchvision==0.24.1
python -m pip install . ./apps/studio

python .binder/register_studio.py
15 changes: 15 additions & 0 deletions .binder/register_studio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""Register the personal launcher in the Python environment running Jupyter."""

import json
import shutil
import sys
import sysconfig
from pathlib import Path

if __name__ == "__main__":
module = Path(__file__).with_name("dendrinet_binder.py")
shutil.copyfile(module, Path(sysconfig.get_path("purelib")) / module.name)
config = Path(sys.prefix) / "etc/jupyter/jupyter_server_config.d"
config.mkdir(parents=True, exist_ok=True)
settings = {"ServerApp": {"jpserver_extensions": {"dendrinet_binder": True}}}
(config / "dendrinet_binder.json").write_text(json.dumps(settings) + "\n")
122 changes: 122 additions & 0 deletions .binder/test_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"""Exercise the browser launch through an authenticated, path-prefixed Jupyter proxy."""

import csv
import json
import math
import os
import secrets
import subprocess
import sys
import time
from contextlib import contextmanager
from urllib.parse import urljoin, urlsplit

import yaml
from playwright.sync_api import expect, sync_playwright


@contextmanager
def personal_server(root):
root.mkdir()
runtime = root / "runtime"
token = secrets.token_urlsafe()
env = {
**os.environ,
"JUPYTER_CONFIG_DIR": str(root / "config"),
"JUPYTER_RUNTIME_DIR": str(runtime),
"JUPYTER_TOKEN": token,
}
with (root / "server.log").open("w") as log:
proc = subprocess.Popen(
[
sys.executable,
"-m",
"jupyter_server",
"--no-browser",
"--ServerApp.base_url=/user/visitor/",
],
cwd=root,
env=env,
stdout=log,
stderr=subprocess.STDOUT,
)
try:
info = runtime / f"jpserver-{proc.pid}.json"
for _ in range(300):
if info.exists() and info.stat().st_size:
break
if proc.poll() is not None:
raise RuntimeError("Personal Jupyter server exited during startup")
time.sleep(0.1)
base = json.loads(info.read_text())["url"]
yield urljoin(base, "open-studio"), token
finally:
proc.terminate()
proc.wait(timeout=30)


def test_personal_session_training_and_exports(tmp_path):
with personal_server(tmp_path / "first") as (entry, token):
with sync_playwright() as engine:
browser = engine.chromium.launch()
page = browser.new_page(accept_downloads=True)
response = page.request.get(entry, max_redirects=0)
assert response.status in (302, 403)
assert "/proxy/" not in response.headers.get("location", "")
page.goto(f"{entry}?token={token}", timeout=90_000)
page.locator("svg.network .card").first.wait_for()
address = urlsplit(page.url)
assert address.path.startswith("/user/visitor/proxy/")
first_secret = address.fragment.split("&")[0]
assert first_secret

page.get_by_role("tab", name="Training").click()
epochs = page.locator('[data-key="training.main.common.epochs"]')
epochs.fill("1")
epochs.press("Enter")
keys = page.evaluate("Object.keys(localStorage)")
assert f"dendrinet-studio-draft-v1:{address.path}" in keys
page.get_by_role("button", name="Train").click()
run_name = page.locator("dialog.dialog input")
run_name.fill("Personal example")
run_name.press("Enter")
card = page.locator(".run-card", has_text="Personal example")
expect(card.locator(".status")).to_contain_text(
"Completed", timeout=180_000
)
card.locator("input[type=checkbox]").check()
with page.expect_download() as curves:
page.get_by_role("button", name="Curves (CSV)").click()
with curves.value.path().open() as f:
rows = list(csv.DictReader(f))
assert len(rows) == 1 and rows[0]["epoch"] == "1"
for split in ("train", "validation"):
assert math.isfinite(float(rows[0][f"Personal example {split}"]))
page.get_by_role("tab", name="YAML").click()
with page.expect_download() as config:
page.get_by_role("button", name="Export").click()
raw = yaml.safe_load(config.value.path().read_text())
assert raw["training"]["main"]["common"]["epochs"] == 1
assert raw["data"]["dataset_name"] == "linear_separable"
reopened = page.request.get(entry, max_redirects=0)
assert urlsplit(reopened.headers["location"]).fragment == first_secret
browser.close()

with (
personal_server(tmp_path / "second") as (entry, token),
sync_playwright() as engine,
):
client = engine.request.new_context()
reply = client.get(f"{entry}?token={token}", max_redirects=0, timeout=90_000)
assert reply.status == 302
address = urlsplit(urljoin(entry, reply.headers["location"]))
assert address.fragment and address.fragment != first_secret
runs = address._replace(path=address.path + "api/runs", fragment="").geturl()
assert client.get(runs, headers={"X-Studio-Token": first_secret}).status == 403
assert (
client.get(runs, headers={"X-Studio-Token": address.fragment}).json()[
"runs"
]
== []
)
client.dispose()
3 changes: 3 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
python "$GITHUB_WORKSPACE/setup/check_installed.py"
python "$GITHUB_WORKSPACE/setup/check_installed_sweep.py"
python -m pytest "$GITHUB_WORKSPACE/apps/studio/tests" -q
python -m pip install jupyter-server-proxy==4.6.1
python "$GITHUB_WORKSPACE/.binder/register_studio.py"
python -m pytest "$GITHUB_WORKSPACE/.binder/test_session.py" -q
- uses: actions/upload-artifact@v4
with:
name: qualified-core
Expand Down
50 changes: 49 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,63 @@
# Changelog

## Unreleased
## 0.6.0

- The installation guides start with the published core and Studio packages
and show how to run the synthetic tutorial outside a source checkout.
The Studio guide also covers optional GPU training in a cluster allocation.
- Release maintainers can select a project-scoped upload token when their
package index does not support the enterprise identity issuer. Promotion
checks the staging tag, upload job and file hashes. Trusted Publishing
remains the default.
- Update the Black development formatter and pre-commit hook to 26.10.1.

### Core library 0.6.0

- Set a population projection's travel time with `delay_steps` or
`delay_steps_by_level`. Delayed projections default to one update.
Longer delays carry source outputs across sequence chunks and support
backpropagation through those outputs. A zero-probability route keeps
its source columns without storing earlier samples.

### DendriNet Studio 0.2.0

- Add a compact contextual-remapping template on EMNIST Balanced. Explore
how a cue changes a character's target in a two-layer E/I network, or
export its configuration with `dendritic-example contextual_remapping_population`.

- Show and edit the receiving compartment's response time at each depth.
Add multiple same-step excitatory sources from the receiving population
and see which sources share its contact budget.
- Set a shared or depth-specific travel delay in the connection editor. The
diagram labels delayed routes and the inspector shows travel steps beside
each receiving depth's response time.
- Open Studio from the documentation in a personal Binder session, train
the two-class example on a CPU and download the configuration and curves.
- Connect two populations from the diagram or choose both endpoints and the
projection timing before applying an edit. Surface the receiving E/I budget
and validate route changes with DendriNet before saving them.
- Add feedforward and recurrent layers in one population network. Preserve
explicit readouts and per-level contact settings when extending a design.
Copy a local inhibitory projection only when the receiver has eligible
inhibitory contacts. Stepped layers require exact gradient credit.
- Apply successive inspector edits in order. Morphology and routing edits
use the latest validated time constants and depth-specific contact counts.
Resetting to uniform counts and then editing one depth preserves both edits.
Studio reports a missing source if a depth-restricted pathway leaves
contacts at an unreachable receiving depth.
The inspector can repair that error by adding the depth to a connection.
The connection editor can also add a source at an uncovered depth.
A confirmed removal can repair an invalid population or layer. Removing
the implicit readout layer preserves a compatible population override on
the preceding layer and clears one that no longer applies.
Renames and per-depth time edits use the current draft, including after Undo
or Redo. Editing an inactive route preserves the shared contact count.
Model checks, training, export and copy wait for pending connection edits.
YAML Export and Copy use the current design during preview refresh and
preserve any unapplied edits in the text editor.
- Align populations in a column per layer, label layer dynamics, and identify
inhibitory feedback with both a dashed line and a bar.

## 0.5.0

### Core library
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

In a fresh Python 3.10 or later environment, install the library with
`python -m pip install dendritic-modeling==0.5.0`. To use the graphical
editor, run `python -m pip install dendrinet-studio==0.1.0` and
editor, run `python -m pip install --upgrade dendrinet-studio` and
`dendrinet-studio --workspace my-runs`. Studio installs the compatible core.

The installation guide covers virtual environments, PyTorch CPU and CUDA
Expand Down
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,45 @@ For the Python library and command-line tools, install the core from PyPI
in a Python 3.10 or later environment.

```bash
python -m pip install dendritic-modeling==0.5.0
python -m pip install --upgrade dendritic-modeling
```

The import name is `dendritic_modeling`. The examples run on a CPU.
The installation guide covers virtual environments, CPU and CUDA builds
of PyTorch, optional dependencies and editable installs for contributors.
[PyPI release](https://pypi.org/project/dendritic-modeling/0.5.0/) ·
[Core on PyPI](https://pypi.org/project/dendritic-modeling/) ·
[Installation guide](docs/installation.rst)

## DendriNet Studio

Studio lets you draw feedforward and recurrent networks, inspect a neuron's
dendrites and compare runs in your browser. Open a terminal on your laptop.
dendrites and compare runs in your browser.

**[Open Studio 0.2.0 online](https://mybinder.org/v2/gh/KempnerInstitute/DendriNet/studio-v0.2.0?urlpath=open-studio)**
to try the editor in a personal CPU session. No account or local installation is
required. In **Training**, set **Epochs** to `1` and select **Train** to try the
two-class example. Download your YAML and loss curves before the session expires.
Before 0.2.0 is tagged, use the **Try it** link in [PR #404](https://github.com/KempnerInstitute/DendriNet/pull/404).

For GPU training, start Studio on an allocated compute node and choose
**GPU if available** beside **Train**. You can open it through Open OnDemand,
Cursor or SSH. [Cluster GPU instructions](docs/studio.rst#train-on-a-cluster-gpu)

With Studio 0.2.0 and DendriNet 0.6.x, select a population to add an
incoming source, or select a delayed connection to set its travel time at
each dendritic depth. The laptop commands below install the latest
compatible pair published on PyPI. Check your installed versions with
`python -m pip show dendrinet-studio dendritic-modeling`.

To keep runs on your own computer, open a terminal on your laptop.
On an Apple silicon Mac or a Linux laptop with Python 3.10 or later, run
these commands the first time. Installing Studio also installs DendriNet and
PyTorch. On a Mac, use the arm64 build of Python.

```bash
python3 -m venv ~/dendrinet-env
source ~/dendrinet-env/bin/activate
python -m pip install dendrinet-studio==0.1.0
python -m pip install --upgrade dendrinet-studio
dendrinet-studio --workspace ~/dendrinet-runs
```

Expand All @@ -70,7 +88,7 @@ Press **Ctrl+C** in the terminal to stop Studio. Next time, activate the
same environment and repeat the `dendrinet-studio --workspace` command above
to see your saved runs. The editor also exports YAML for `dendritic-train`.
[Illustrated Studio guide](https://kempnerinstitute.github.io/DendriNet/studio.html#studio-first-run) ·
[Studio on PyPI](https://pypi.org/project/dendrinet-studio/0.1.0/)
[Studio on PyPI](https://pypi.org/project/dendrinet-studio/)

## First steps

Expand Down
7 changes: 4 additions & 3 deletions README_PYPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ shunting and additive integration, population networks, training and analysis.
## Install and train a first model

```bash
python -m pip install dendritic-modeling==0.5.0
python -m pip install dendritic-modeling
dendritic-example synthetic_population --output demo.yaml
dendritic-train demo.yaml --epochs 1
```
Expand All @@ -22,12 +22,13 @@ reproduction requires the study's recorded dependencies, source and settings.

## Graphical model editor

Install the companion distribution with `python -m pip install dendrinet-studio==0.1.0` to draw dendritic
Install the companion distribution with `python -m pip install --upgrade dendrinet-studio` to draw dendritic
populations, trace incoming E and I connections, and compare training runs on
your computer. Launch it with `dendrinet-studio --workspace my-runs`. Designs
export as YAML that the core training command accepts. The
[Studio guide](https://kempnerinstitute.github.io/DendriNet/studio.html)
includes a first run with generated data and a worked synapse-count example.
includes a first run with generated data, a worked synapse-count example,
and [instructions for training on a cluster GPU](https://kempnerinstitute.github.io/DendriNet/studio.html#studio-cluster-gpu).

- [Documentation](https://kempnerinstitute.github.io/DendriNet/)
- [Source and examples](https://github.com/KempnerInstitute/DendriNet)
Expand Down
Loading
Loading