Skip to content

Ask a cellmap export which of its two shapes it runs at - #153

Merged
davidackerman merged 1 commit into
mainfrom
export-shape-probe
Oct 22, 2026
Merged

davidackerman merged 1 commit into
mainfrom
export-shape-probe

Conversation

@davidackerman

Copy link
Copy Markdown
Collaborator

#150's fix for the cellmap model type read the metadata's inference shapes, which made jrc_mus-livers_16nm_to_8nm_mito work (its TorchScript is traced at the inference 288³ and fails at the training 216³) and broke mito_aff_unet_setup_16, which is traced the other way round (training 178³ → 56³; fed the inference 378³ it still answers 56³). Found in tonight's live try: every chunk failed shape validation, after a 378³ forward that on a CPU outlived the local launcher's 300 s startup timeout.

cellmap_models traces the export at whichever shape the exporter passed and records both shapes without saying which, so the type now asks the model (runs_at): a forward at the training shape that answers the training output means the training shapes; a failure or another output means the inference shapes. The probe is the cheap direction (the smaller input; a mismatch fails fast): 3.7 s for the liver model and 9.1 s for setup_16 on a CPU, model load included; milliseconds on a GPU.

Checked on both real models (liver → 288³/212³, setup_16 → 178³/56³) and with three stand-ins in tests/utils/test_cellmap_model_type.py. Also merged into #152's branch for the live test.

https://claude.ai/code/session_01EzWMS4pG3tm1ZtvKULfSfW

#150 made the cellmap model type read the metadata's inference shapes,
which fixed jrc_mus-livers_16nm_to_8nm_mito (traced at its inference 288³,
it fails at its training 216³) and broke mito_aff_unet_setup_16 (traced at
its training 178³ → 56³, it answers 56³ to the inference 378³, so every
chunk failed shape validation, after a 378³ forward that on a CPU outlived
the local launcher's startup timeout). cellmap_models traces at whichever
shape the exporter passed and records both without saying which, so the
type now probes: a forward at the training shape that answers the
training output means the training shapes, anything else the inference
shapes. The probe is the cheap one (the smaller input; a mismatch fails
fast): 3.7 s for the liver model and 9.1 s for setup_16 on a CPU, model
load included.

Claude-Session: https://claude.ai/code/session_01EzWMS4pG3tm1ZtvKULfSfW
@davidackerman
davidackerman merged commit 6fa0b7b into main Oct 22, 2026
7 checks passed
@davidackerman
davidackerman deleted the export-shape-probe branch October 22, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant