diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f618bfab3d..402415c02a 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -37,7 +37,7 @@ jobs: which python python -m pip install --upgrade pip wheel python -m pip uninstall -y torch torchvision - python -m pip install torch==1.10.1+cu111 torchvision==0.11.2+cu111 -f https://download.pytorch.org/whl/torch_stable.html + python -m pip install torch==1.11+cu111 torchvision==0.12+cu111 -f https://download.pytorch.org/whl/torch_stable.html python -m pip install -r requirements-dev.txt - name: Run integration tests run: | diff --git a/.github/workflows/pythonapp-gpu.yml b/.github/workflows/pythonapp-gpu.yml index 68fdfde445..c2c0164306 100644 --- a/.github/workflows/pythonapp-gpu.yml +++ b/.github/workflows/pythonapp-gpu.yml @@ -25,6 +25,7 @@ jobs: - "PT19+CUDA114" - "PT110+CUDA116" - "PT110+CUDA102" + - "PT111+CUDA102" include: # https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes - environment: PT17+CUDA102 @@ -51,6 +52,9 @@ jobs: - environment: PT110+CUDA102 pytorch: "torch==1.10.1 torchvision==0.11.2" base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04" + - environment: PT111+CUDA102 + pytorch: "torch==1.11.0 torchvision==0.12.0" + base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04" container: image: ${{ matrix.base }} options: --gpus all @@ -61,7 +65,8 @@ jobs: run: | if [ ${{ matrix.environment }} = "PT17+CUDA102" ] || \ [ ${{ matrix.environment }} = "PT18+CUDA102" ] || \ - [ ${{ matrix.environment }} = "PT110+CUDA102" ] + [ ${{ matrix.environment }} = "PT110+CUDA102" ] || \ + [ ${{ matrix.environment }} = "PT111+CUDA102" ] then PYVER=3.7 PYSFX=3 DISTUTILS=python3-distutils && \ apt-get update && apt-get install -y --no-install-recommends \ diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index b7816542ea..c3294c2b2a 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -51,11 +51,11 @@ jobs: - if: runner.os == 'windows' name: Install torch cpu from pytorch.org (Windows only) run: | - python -m pip install torch==1.10.1+cpu -f https://download.pytorch.org/whl/torch_stable.html + python -m pip install torch==1.11.0+cpu -f https://download.pytorch.org/whl/torch_stable.html - name: Install the dependencies run: | # min. requirements - python -m pip install torch==1.10.1 + python -m pip install torch==1.11.0 python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions @@ -101,7 +101,7 @@ jobs: - name: Install the dependencies run: | # min. requirements - python -m pip install torch==1.10.1 + python -m pip install torch==1.11.0 python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions @@ -119,7 +119,7 @@ jobs: strategy: fail-fast: false matrix: - pytorch-version: [1.6.0, 1.7.1, 1.8.1, 1.9.1, latest] + pytorch-version: [1.6.0, 1.7.1, 1.8.1, 1.9.1, 1.10.1, latest] timeout-minutes: 40 steps: - uses: actions/checkout@v2 @@ -156,6 +156,8 @@ jobs: python -m pip install torch==1.8.1 elif [ ${{ matrix.pytorch-version }} == "1.9.1" ]; then python -m pip install torch==1.9.1 + elif [ ${{ matrix.pytorch-version }} == "1.10.1" ]; then + python -m pip install torch==1.10.1 fi python -m pip install -r requirements-min.txt python -m pip list diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 7237c8d54d..cf251c2293 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -87,10 +87,10 @@ jobs: - if: runner.os == 'windows' name: Install torch cpu from pytorch.org (Windows only) run: | - python -m pip install torch==1.10.1+cpu torchvision==0.11.2+cpu -f https://download.pytorch.org/whl/torch_stable.html + python -m pip install torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/torch_stable.html - name: Install the dependencies run: | - python -m pip install torch==1.10.1 torchvision==0.11.2 + python -m pip install torch==1.11.0 torchvision==0.12.0 cat "requirements-dev.txt" python -m pip install -r requirements-dev.txt python -m pip list diff --git a/.github/workflows/setupapp.yml b/.github/workflows/setupapp.yml index 4ae18d756a..02911ea51f 100644 --- a/.github/workflows/setupapp.yml +++ b/.github/workflows/setupapp.yml @@ -44,7 +44,7 @@ jobs: python -m pip install --upgrade pip wheel python -m pip uninstall -y torch torchvision rm -rf $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/ruamel* - python -m pip install torch==1.10.1 torchvision==0.11.2 + python -m pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html python -m pip install -r requirements-dev.txt - name: Run unit tests report coverage run: | @@ -98,7 +98,7 @@ jobs: - name: Install the dependencies run: | python -m pip install --upgrade pip wheel - python -m pip install torch==1.10.1 torchvision==0.11.2 + python -m pip install torch==1.11.0 torchvision==0.12.0 python -m pip install -r requirements-dev.txt - name: Run quick tests CPU ubuntu run: | diff --git a/monai/apps/pathology/transforms/spatial/array.py b/monai/apps/pathology/transforms/spatial/array.py index b271a3331f..a44dce1e3f 100644 --- a/monai/apps/pathology/transforms/spatial/array.py +++ b/monai/apps/pathology/transforms/spatial/array.py @@ -203,7 +203,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor: c, h, w = img_np.shape pad_h = (self.tile_size - h % self.tile_size) % self.tile_size pad_w = (self.tile_size - w % self.tile_size) % self.tile_size - img_np = np.pad( + img_np = np.pad( # type: ignore img_np, [[0, 0], [pad_h // 2, pad_h - pad_h // 2], [pad_w // 2, pad_w - pad_w // 2]], constant_values=self.background_val, @@ -220,7 +220,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor: strides=(x_stride * x_step, y_stride * y_step, c_stride, x_stride, y_stride), writeable=False, ) - img_np = llw.reshape(-1, c_image, h_tile, w_tile) + img_np = llw.reshape(-1, c_image, h_tile, w_tile) # type: ignore # if keeping all patches if self.tile_count is None: @@ -251,7 +251,7 @@ def __call__(self, image: NdarrayOrTensor) -> NdarrayOrTensor: img_np = img_np[self.random_idxs] elif len(img_np) < self.tile_count: - img_np = np.pad( + img_np = np.pad( # type: ignore img_np, [[0, self.tile_count - len(img_np)], [0, 0], [0, 0], [0, 0]], constant_values=self.background_val, diff --git a/monai/transforms/intensity/array.py b/monai/transforms/intensity/array.py index 38fb01e6fb..da46b105e1 100644 --- a/monai/transforms/intensity/array.py +++ b/monai/transforms/intensity/array.py @@ -1405,7 +1405,7 @@ def __call__(self, img: NdarrayOrTensor, randomize: bool = True) -> NdarrayOrTen img_min, img_max = img_np.min(), img_np.max() reference_control_points_scaled = self.reference_control_points * (img_max - img_min) + img_min floating_control_points_scaled = self.floating_control_points * (img_max - img_min) + img_min - img_np = np.asarray( + img_np = np.asarray( # type: ignore np.interp(img_np, reference_control_points_scaled, floating_control_points_scaled), dtype=img_np.dtype ) img, *_ = convert_to_dst_type(img_np, dst=img) diff --git a/monai/visualize/utils.py b/monai/visualize/utils.py index be4f3f60fc..c1111abd82 100644 --- a/monai/visualize/utils.py +++ b/monai/visualize/utils.py @@ -107,7 +107,7 @@ def matshow3d( vol = np.concatenate([pad(v) for v in vol], axis=0) else: # ndarray while len(vol.shape) < 3: - vol = np.expand_dims(vol, 0) # so that we display 2d as well + vol = np.expand_dims(vol, 0) # type: ignore # so that we display 2d as well if channel_dim is not None: # move the expected dim to construct frames with `B` dim vol = np.moveaxis(vol, frame_dim, -4) # type: ignore