Skip to content

Commit 60c7b36

Browse files
authored
Merge branch 'dev' into 8094-modify-dice-loss
2 parents f3ab679 + 44e249d commit 60c7b36

File tree

92 files changed

+2689
-325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2689
-325
lines changed

.github/workflows/blossom-ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ jobs:
3434
(
3535
github.actor == 'Nic-Ma' ||
3636
github.actor == 'wyli' ||
37-
github.actor == 'pxLi' ||
38-
github.actor == 'YanxuanLiu' ||
37+
github.actor == 'wendell-hom' ||
3938
github.actor == 'KumoLiu'
4039
)
4140
steps:

.github/workflows/cron.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
- "PT110+CUDA113"
1717
- "PT113+CUDA118"
1818
- "PT210+CUDA121"
19-
- "PTLATEST+CUDA124"
19+
- "PT240+CUDA126"
20+
- "PTLATEST+CUDA126"
2021
include:
2122
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
2223
- environment: PT110+CUDA113
@@ -28,9 +29,12 @@ jobs:
2829
- environment: PT210+CUDA121
2930
pytorch: "pytorch==2.1.0 torchvision==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu121"
3031
base: "nvcr.io/nvidia/pytorch:23.08-py3" # CUDA 12.1
31-
- environment: PTLATEST+CUDA124
32+
- environment: PT240+CUDA126
33+
pytorch: "pytorch==2.4.0 torchvision==0.19.0 --extra-index-url https://download.pytorch.org/whl/cu121"
34+
base: "nvcr.io/nvidia/pytorch:24.08-py3" # CUDA 12.6
35+
- environment: PTLATEST+CUDA126
3236
pytorch: "-U torch torchvision --extra-index-url https://download.pytorch.org/whl/cu121"
33-
base: "nvcr.io/nvidia/pytorch:24.08-py3" # CUDA 12.4
37+
base: "nvcr.io/nvidia/pytorch:24.10-py3" # CUDA 12.6
3438
container:
3539
image: ${{ matrix.base }}
3640
options: "--gpus all"
@@ -80,7 +84,7 @@ jobs:
8084
if: github.repository == 'Project-MONAI/MONAI'
8185
strategy:
8286
matrix:
83-
container: ["pytorch:23.08", "pytorch:24.08"]
87+
container: ["pytorch:23.08", "pytorch:24.08", "pytorch:24.10"]
8488
container:
8589
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
8690
options: "--gpus all"
@@ -129,7 +133,7 @@ jobs:
129133
if: github.repository == 'Project-MONAI/MONAI'
130134
strategy:
131135
matrix:
132-
container: ["pytorch:24.08"]
136+
container: ["pytorch:24.10"]
133137
container:
134138
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
135139
options: "--gpus all"
@@ -233,7 +237,7 @@ jobs:
233237
if: github.repository == 'Project-MONAI/MONAI'
234238
needs: cron-gpu # so that monai itself is verified first
235239
container:
236-
image: nvcr.io/nvidia/pytorch:24.08-py3 # testing with the latest pytorch base image
240+
image: nvcr.io/nvidia/pytorch:24.10-py3 # testing with the latest pytorch base image
237241
options: "--gpus all --ipc=host"
238242
runs-on: [self-hosted, linux, x64, integration]
239243
steps:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ tests/testing_data/nrrd_example.nrrd
149149
# clang format tool
150150
.clang-format-bin/
151151

152+
# ctags
153+
tags
154+
152155
# VSCode
153156
.vscode/
154157
*.zip

.pre-commit-config.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.6.0
12+
rev: v5.0.0
1313
hooks:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
@@ -26,33 +26,30 @@ repos:
2626
args: ['--autofix', '--no-sort-keys', '--indent=4']
2727
- id: end-of-file-fixer
2828
- id: mixed-line-ending
29-
- repo: https://github.com/charliermarsh/ruff-pre-commit
30-
rev: v0.3.5
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
30+
rev: v0.7.0
3131
hooks:
3232
- id: ruff
3333
args:
3434
- --fix
3535

3636
- repo: https://github.com/asottile/pyupgrade
37-
rev: v3.3.1
37+
rev: v3.19.0
3838
hooks:
3939
- id: pyupgrade
40-
args: [--py37-plus]
41-
name: Upgrade code excluding monai networks
40+
args: [--py39-plus, --keep-runtime-typing]
41+
name: Upgrade code with exceptions
4242
exclude: |
4343
(?x)(
4444
^versioneer.py|
4545
^monai/_version.py|
46-
^monai/networks/| # no PEP 604 for torchscript tensorrt
47-
^monai/losses/ # no PEP 604 for torchscript tensorrt
46+
^monai/networks/| # avoid typing rewrites
47+
^monai/apps/detection/utils/anchor_utils.py| # avoid typing rewrites
48+
^tests/test_compute_panoptic_quality.py # avoid typing rewrites
4849
)
49-
- id: pyupgrade
50-
args: [--py37-plus, --keep-runtime-typing]
51-
name: Upgrade monai networks
52-
files: (?x)(^monai/networks/)
5350
5451
- repo: https://github.com/asottile/yesqa
55-
rev: v1.4.0
52+
rev: v1.5.0
5653
hooks:
5754
- id: yesqa
5855
name: Unused noqa

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# To build with a different base image
1313
# please run `docker build` using the `--build-arg PYTORCH_IMAGE=...` flag.
14-
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:24.08-py3
14+
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:24.10-py3
1515
FROM ${PYTORCH_IMAGE}
1616

1717
LABEL maintainer="monai.contact@gmail.com"
@@ -41,6 +41,10 @@ RUN cp /tmp/requirements.txt /tmp/req.bak \
4141
COPY LICENSE CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md README.md versioneer.py setup.py setup.cfg runtests.sh MANIFEST.in ./
4242
COPY tests ./tests
4343
COPY monai ./monai
44+
45+
# TODO: remove this line and torch.patch for 24.11
46+
RUN patch -R -d /usr/local/lib/python3.10/dist-packages/torch/onnx/ < ./monai/torch.patch
47+
4448
RUN BUILD_MONAI=1 FORCE_CUDA=1 python setup.py develop \
4549
&& rm -rf build __pycache__
4650

@@ -57,4 +61,6 @@ RUN apt-get update \
5761
# append /opt/tools to runtime path for NGC CLI to be accessible from all file system locations
5862
ENV PATH=${PATH}:/opt/tools
5963
ENV POLYGRAPHY_AUTOINSTALL_DEPS=1
64+
65+
6066
WORKDIR /opt/monai

docs/source/networks.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ Nets
630630
.. autoclass:: ViTAutoEnc
631631
:members:
632632

633+
`MaskedAutoEncoderViT`
634+
~~~~~~~~~~~~~~~~~~~~~~
635+
.. autoclass:: MaskedAutoEncoderViT
636+
:members:
637+
633638
`FullyConnectedNet`
634639
~~~~~~~~~~~~~~~~~~~
635640
.. autoclass:: FullyConnectedNet

docs/source/transforms.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,18 @@ Utility
11801180
:members:
11811181
:special-members: __call__
11821182

1183+
`TorchIO`
1184+
"""""""""
1185+
.. autoclass:: TorchIO
1186+
:members:
1187+
:special-members: __call__
1188+
1189+
`RandTorchIO`
1190+
"""""""""""""
1191+
.. autoclass:: RandTorchIO
1192+
:members:
1193+
:special-members: __call__
1194+
11831195
`MapLabelValue`
11841196
"""""""""""""""
11851197
.. autoclass:: MapLabelValue
@@ -2253,6 +2265,18 @@ Utility (Dict)
22532265
:members:
22542266
:special-members: __call__
22552267

2268+
`TorchIOd`
2269+
""""""""""
2270+
.. autoclass:: TorchIOd
2271+
:members:
2272+
:special-members: __call__
2273+
2274+
`RandTorchIOd`
2275+
""""""""""""""
2276+
.. autoclass:: RandTorchIOd
2277+
:members:
2278+
:special-members: __call__
2279+
22562280
`MapLabelValued`
22572281
""""""""""""""""
22582282
.. autoclass:: MapLabelValued

environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ channels:
77
dependencies:
88
- numpy>=1.24,<2.0
99
- pytorch>=1.9
10+
- torchio
1011
- torchvision
1112
- pytorch-cuda>=11.6
1213
- pip

monai/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
from __future__ import annotations
1313

14+
import logging
1415
import os
1516
import sys
16-
import logging
1717
import warnings
18-
from ._version import get_versions
1918

19+
from ._version import get_versions
2020

2121
old_showwarning = warnings.showwarning
2222

monai/apps/detection/networks/retinanet_network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import math
4343
import warnings
4444
from collections.abc import Callable, Sequence
45-
from typing import Any, Dict
45+
from typing import Any
4646

4747
import torch
4848
from torch import Tensor, nn
@@ -330,7 +330,7 @@ def forward(self, images: Tensor) -> Any:
330330
features = self.feature_extractor(images)
331331
if isinstance(features, Tensor):
332332
feature_maps = [features]
333-
elif torch.jit.isinstance(features, Dict[str, Tensor]):
333+
elif torch.jit.isinstance(features, dict[str, Tensor]):
334334
feature_maps = list(features.values())
335335
else:
336336
feature_maps = list(features)

0 commit comments

Comments
 (0)