Skip to content

Commit

Permalink
Test out newer versions of PyTorch (torch>=2.0.0) for compatibility…
Browse files Browse the repository at this point in the history
… with downstream projects (SCT, ADS) (#1304)
  • Loading branch information
joshuacwnewton committed Dec 11, 2023
1 parent de2bb20 commit c52689d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions ivadomed/loader/utils.py
Expand Up @@ -13,7 +13,6 @@
import torch
from loguru import logger
from sklearn.model_selection import train_test_split
from torch._six import string_classes
from ivadomed import utils as imed_utils
from ivadomed.keywords import SplitDatasetKW, LoaderParamsKW, ROIParamsKW, ContrastParamsKW
import nibabel as nib
Expand Down Expand Up @@ -270,7 +269,7 @@ def imed_collate(batch: dict) -> dict | list | str | torch.Tensor:
return torch.LongTensor(batch)
elif isinstance(batch[0], float):
return torch.DoubleTensor(batch)
elif isinstance(batch[0], string_classes):
elif isinstance(batch[0], str):
return batch
elif isinstance(batch[0], collections.abc.Mapping):
return {key: imed_collate([d[key] for d in batch]) for key in batch[0]}
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Expand Up @@ -11,12 +11,12 @@ imageio>=2.31.4
joblib~=1.0
matplotlib>=3.3.0
nibabel~=3.2
onnxruntime~=1.7
onnx
# 1.7.0>onnxruntime>=1.5.1 required `brew install libomp` on macOS.
# So, pin to >=1.7.0 to avoid having to ask users to install libomp.
# Avoid version 1.16.0 due to: https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/4225
onnxruntime>=1.7.0,!=1.16.0
pandas>=1.1,<1.5.0
# We pin Pillow here because we're currently using an older version of `torch`, which in turn uses an
# older version of `tensorboard`, which in turn uses a deprecated feature of Pillow.
# Once we update `torch`, the deprecated call will be removed, and we can then unpin Pillow.
Pillow<10.0.0
pybids>=0.14.0,<0.15.6
scikit-learn>=0.20.3
scikit-image~=0.17
Expand All @@ -25,6 +25,6 @@ tensorboard>=1.15.0
tqdm>=4.30
scipy
torchio>=0.18.68
torch>=1.8.1,<=1.11.0
torchvision>=0.9.1,<=0.12.0
torch>=1.8.1
torchvision>=0.9.1
wandb>=0.12.11

0 comments on commit c52689d

Please sign in to comment.