fix: update runner.sh and endoscopic notebook for MONAI 1.6 tutorial runner compatibility (#2065)
### Description
Fixes tutorial runner failures observed during MONAI 1.6 release testing
(Docker image, Python 3.12, RTX 5090). Full diagnostics in [this
comment](https://github.com/Project-MONAI/tutorials/pull/2065#issuecomment-4902615909).
> **Depends on
[Project-MONAI/MONAI#8912](https://github.com/Project-MONAI/MONAI/pull/8912)**
> That PR updates the MONAI Docker image (`Dockerfile` +
`requirements-dev.txt`) with the environment fixes that several
tutorials here rely on: it pins `mlflow<3.0` (fixes R1 — 4 mlflow-using
notebooks that fail on Python 3.12), pins `transformers<5.0` (fixes R3 —
`torch.float8_e8m0fnu` missing in the base PyTorch build), adds `aim`
(fixes R6 — spleen segmentation AIM tutorial), and adds `lightning>=2.0`
as a declared dependency. Without #8912 the Docker image still installs
broken versions of those packages, so those tutorial failures persist
regardless of the changes in this PR.
### Failures addressed
| ID | Root cause | Affected notebook | Fix applied | Needs #8912 |
|---|---|---|---|---|
| R1 | `mlflow 3.x` fails on Python 3.12 (`from .. import zipp` relative
import) | 4 mlflow-using notebooks | Pin `mlflow<3.0` in
`requirements-dev.txt` | ✅ Fixed in #8912 |
| R3 | `transformers 5.x` references `torch.float8_e8m0fnu` absent in
the base PyTorch build | `2d_regression/image_restoration.ipynb`
(transitively) | Pin `transformers<5.0` in `requirements-dev.txt` | ✅
Fixed in #8912 |
| R4 | `monai.networks.nets.restormer` not present in this branch |
`2d_regression/image_restoration.ipynb` | Added to `skip_run_papermill`
in `runner.sh` | — |
| R5 | `monai.bundle.load()` returns `OrderedDict` in older local branch
— local-only issue; upstream MONAI ≥1.5 already returns `nn.Module` by
default |
`computer_assisted_intervention/endoscopic_inbody_classification.ipynb`
| Reverted erroneous `return_state_dict=False` kwarg; original notebook
is correct | — |
| R6 | `aim` package not installed in the Docker image |
`modules/spleen_segmentation_aim.ipynb` | Add `aim` to
`requirements-dev.txt` | ✅ Fixed in #8912 |
| R7 | `pytorch-lightning~=2.0.0` (resolves to 2.0.9) eagerly imports
`mlflow` at module level; `mlflow 3.x` fails on Python 3.12 with a
relative-import error | `bundle/05_spleen_segmentation_lightning.ipynb`
| Pinned `pytorch-lightning>=2.1` in notebook (removes the eager mlflow
import; tested with 2.6.5) | Partial — #8912 pins `mlflow<3.0` as a
safety net; this PR removes the fragile import dependency entirely |
| R9 | Runner requires all training notebooks to declare `max_epochs`;
two notebooks have none |
`bundle/msd_crossval_datalist_generator.ipynb`,
`pathology/hovernet_infer_compare.ipynb` | Added both to
`doesnt_contain_max_epochs` exemption list in `runner.sh` | — |
| CI | `deep_atlas_tutorial.ipynb` and
`05_spleen_segmentation_lightning.ipynb` hardcode `device =
torch.device("cuda:0")` / `"cuda"` with no CPU fallback; fail on the
CPU-only GitHub Actions runner | `deep_atlas/deep_atlas_tutorial.ipynb`,
`bundle/05_spleen_segmentation_lightning.ipynb` | Added both to
`skip_run_papermill` in `runner.sh` | — |
| PEP8 | E225/E231 whitespace violations flagged by pre-commit |
`preprocess_detect_scene_and_split_fold.ipynb`,
`deep_atlas_tutorial.ipynb`, `class_lung_lesion.ipynb` | Applied
`autopep8` autofix (no functional changes) | — |
### Checks
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`
— GPU-dependent notebooks (`05_spleen_segmentation_lightning`,
`deep_atlas_tutorial`) require a CUDA device; they are skipped in the
CPU CI runner and verified manually on a local GPU node.
---------
Signed-off-by: R. Garcia-Dias <rafaelagd@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> R
Rafael Garcia-Dias committed
81dcf0f63e2a3a064e882ef0f26d5889b7bedf53
Parent: 7bedfd0
Committed by GitHub <noreply@github.com>
on 7/7/2026, 11:13:56 PM