Skip to content

Fix compatibility with newer PyTorch Lightning, torch_geometric, and SciPy#1

Open
supergolem wants to merge 1 commit into
mlbio-epfl:mainfrom
supergolem:pytorch2-compat
Open

Fix compatibility with newer PyTorch Lightning, torch_geometric, and SciPy#1
supergolem wants to merge 1 commit into
mlbio-epfl:mainfrom
supergolem:pytorch2-compat

Conversation

@supergolem

Copy link
Copy Markdown

Changes

utils/data/abstract_datatype.py

  • LightningDataset (torch_geometric) has been removed in newer versions.
  • Replaced with pl.LightningDataModule with manual dataloader wiring.
  • Fixed validation hook name: validation_dataloader -> val_dataloader
    (the original was silently never called by PyTorch Lightning).
  • Added None guard so the module works when no validation set is provided.

utils/diffusion_model/setup/setup.py

  • check_val_every_n_epoch=0 no longer disables validation in newer PL —
    changed to None.
  • Added num_sanity_val_steps=0 to suppress the sanity check when validation is disabled.

metrics/evaluation_statistics.py

  • return_sensitivity=True raises ValueError in newer SciPy versions
    (documented in the README as "use SciPy 1.9.1").
  • Removed dependency on the sensitivity output, which is unused by all callers.
  • Also catches ValueError explicitly.

example/MERFISH_mouse_cortex.ipynb

  • Restored relative data path.
  • Removed machine-specific training cell.
  • Cleared execution outputs.

Tested on Python 3.10, PyTorch 2.x, PyTorch Lightning 2.x, torch_geometric 2.x.

…SciPy

- abstract_datatype.py: replace removed LightningDataset (torch_geometric)
  with pl.LightningDataModule; fix validation hook name validation_dataloader
  -> val_dataloader (correct PL API); add None guard for missing val dataset
- setup.py: use check_val_every_n_epoch=None (not 0) to disable validation
  in newer PL; add num_sanity_val_steps=0 when validation is off
- evaluation_statistics.py: drop return_sensitivity=True which raises
  ValueError in newer SciPy versions; catch ValueError alongside LinAlgError
- MERFISH_mouse_cortex.ipynb: restore relative data path, remove
  machine-specific training cell, clear execution outputs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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