Skip to content

Commit

Permalink
Merge branch 'Project-MONAI:dev' into add-gradient-accumulation-to-su…
Browse files Browse the repository at this point in the history
…pervised-trainer
  • Loading branch information
jak0bw authored Mar 28, 2023
2 parents 2cc19bb + be3d138 commit 303a1a8
Show file tree
Hide file tree
Showing 100 changed files with 3,595 additions and 433 deletions.
51 changes: 4 additions & 47 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ jobs:
strategy:
matrix:
environment:
- "PT182+CUDA102"
- "PT191+CUDA113"
- "PT110+CUDA113"
- "PT112+CUDA113"
- "PTLATEST+CUDA118"
include:
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
- environment: PT182+CUDA102
pytorch: "torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cu102"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT191+CUDA113
pytorch: "torch==1.9.1 torchvision==0.10.1 --extra-index-url https://download.pytorch.org/whl/cu113"
base: "nvcr.io/nvidia/pytorch:21.06-py3" # CUDA 11.3
Expand All @@ -34,7 +30,7 @@ jobs:
base: "nvcr.io/nvidia/pytorch:21.06-py3" # CUDA 11.3
- environment: PTLATEST+CUDA118
pytorch: "-U torch torchvision --extra-index-url https://download.pytorch.org/whl/cu118"
base: "nvcr.io/nvidia/pytorch:22.12-py3" # CUDA 11.8
base: "nvcr.io/nvidia/pytorch:23.02-py3" # CUDA 11.8
container:
image: ${{ matrix.base }}
options: "--gpus all"
Expand All @@ -43,47 +39,8 @@ jobs:
- uses: actions/checkout@v3
- name: apt install
run: |
# FIXME: workaround for https://github.com/Project-MONAI/MONAI/issues/4200
apt-key del 7fa2af80 && rm -rf /etc/apt/sources.list.d/nvidia-ml.list /etc/apt/sources.list.d/cuda.list
apt-get update
apt-get install -y wget
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb
if [ ${{ matrix.environment }} = "PT182+CUDA102" ]
then
PYVER=3.7 PYSFX=3 DISTUTILS=python3-distutils && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
pkg-config \
python$PYVER \
python$PYVER-dev \
python$PYSFX-pip \
$DISTUTILS \
rsync \
swig \
unzip \
zip \
zlib1g-dev \
libboost-locale-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-thread-dev \
libboost-test-dev \
libgoogle-glog-dev \
libjsoncpp-dev \
cmake \
git && \
rm -rf /var/lib/apt/lists/* && \
export PYTHONIOENCODING=utf-8 LC_ALL=C.UTF-8 && \
rm -f /usr/bin/python && \
rm -f /usr/bin/python`echo $PYVER | cut -c1-1` && \
ln -s /usr/bin/python$PYVER /usr/bin/python && \
ln -s /usr/bin/python$PYVER /usr/bin/python`echo $PYVER | cut -c1-1` &&
curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py;
fi
- name: Install the dependencies
run: |
which python
Expand Down Expand Up @@ -119,7 +76,7 @@ jobs:
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:22.09", "pytorch:22.11", "pytorch:22.12"]
container: ["pytorch:22.09", "pytorch:22.11", "pytorch:23.02"]
container:
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
Expand Down Expand Up @@ -164,7 +121,7 @@ jobs:
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:21.02", "pytorch:21.10", "pytorch:22.12"] # 21.02, 21.10 for backward comp.
container: ["pytorch:22.09", "pytorch:22.11", "pytorch:23.02"]
container:
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
Expand Down Expand Up @@ -264,7 +221,7 @@ jobs:
if: github.repository == 'Project-MONAI/MONAI'
needs: cron-gpu # so that monai itself is verified first
container:
image: nvcr.io/nvidia/pytorch:22.12-py3 # testing with the latest pytorch base image
image: nvcr.io/nvidia/pytorch:23.02-py3 # testing with the latest pytorch base image
options: "--gpus all --ipc=host"
runs-on: [self-hosted, linux, x64, integration]
steps:
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/pythonapp-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ jobs:
strategy:
matrix:
environment:
- "PT18+CUDA102"
- "PT19+CUDA114DOCKER"
- "PT110+CUDA111"
- "PT112+CUDA118DOCKER"
- "PT113+CUDA116"
include:
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
- environment: PT18+CUDA102
# pytorch 1.8.2 LTS
pytorch: "torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cu102"
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
- environment: PT19+CUDA114DOCKER
# 21.10: 1.10.0a0+0aef44c
pytorch: "-h" # we explicitly set pytorch to -h to avoid pip install error
Expand All @@ -46,6 +41,10 @@ jobs:
- environment: PT113+CUDA116
pytorch: "torch==1.13.1 torchvision==0.14.1"
base: "nvcr.io/nvidia/cuda:11.6.1-devel-ubuntu18.04"
- environment: PT114+CUDA120DOCKER
# 23.02: 1.14.0a0+44dac51
pytorch: "-h" # we explicitly set pytorch to -h to avoid pip install error
base: "nvcr.io/nvidia/pytorch:23.02-py3"
container:
image: ${{ matrix.base }}
options: --gpus all --env NVIDIA_DISABLE_REQUIRE=true # workaround for unsatisfied condition: cuda>=11.6
Expand All @@ -55,18 +54,13 @@ jobs:
- name: apt install
if: github.event.pull_request.merged != true
run: |
# FIXME: workaround for https://github.com/Project-MONAI/MONAI/issues/4200
apt-key del 7fa2af80 && rm -rf /etc/apt/sources.list.d/nvidia-ml.list /etc/apt/sources.list.d/cuda.list
apt-get update
apt-get install -y wget
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb
if [ ${{ matrix.environment }} = "PT18+CUDA102" ] || \
[ ${{ matrix.environment }} = "PT110+CUDA111" ] || \
if [ ${{ matrix.environment }} = "PT110+CUDA111" ] || \
[ ${{ matrix.environment }} = "PT113+CUDA116" ]
then
PYVER=3.7 PYSFX=3 DISTUTILS=python3-distutils && \
PYVER=3.8 PYSFX=3 DISTUTILS=python3-distutils && \
apt-get update && apt-get install -y --no-install-recommends \
curl \
pkg-config \
Expand Down Expand Up @@ -134,7 +128,7 @@ jobs:
# build for the current self-hosted CI Tesla V100
BUILD_MONAI=1 TORCH_CUDA_ARCH_LIST="7.0" ./runtests.sh --build --disttests
./runtests.sh --quick --unittests
if [ ${{ matrix.environment }} = "PT18+CUDA102" ]; then
if [ ${{ matrix.environment }} = "PT113+CUDA116" ]; then
# test the clang-format tool downloading once
coverage run -m tests.clang_format_utils
fi
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/pythonapp-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11']
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pytorch-version: ['1.8.2', '1.9.1', '1.10.2', '1.11.0', '1.12.1', 'latest']
pytorch-version: ['1.9.1', '1.10.2', '1.11.0', '1.12.1', '1.13', 'latest']
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -149,16 +149,8 @@ jobs:
# min. requirements
if [ ${{ matrix.pytorch-version }} == "latest" ]; then
python -m pip install torch
elif [ ${{ matrix.pytorch-version }} == "1.8.2" ]; then
python -m pip install torch==1.8.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu
elif [ ${{ matrix.pytorch-version }} == "1.9.1" ]; then
python -m pip install torch==1.9.1
elif [ ${{ matrix.pytorch-version }} == "1.10.2" ]; then
python -m pip install torch==1.10.2
elif [ ${{ matrix.pytorch-version }} == "1.11.0" ]; then
python -m pip install torch==1.11.0
elif [ ${{ matrix.pytorch-version }} == "1.12.1" ]; then
python -m pip install torch==1.12.1
else
python -m pip install torch==${{ matrix.pytorch-version }}
fi
python -m pip install -r requirements-min.txt
python -m pip list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
# install the latest pytorch for testing
# however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated
# fresh torch installation according to pyproject.toml
python -m pip install torch>=1.8 torchvision
python -m pip install torch>=1.9 torchvision
- name: Check packages
run: |
pip uninstall monai
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

versioning:
# compute versioning file from python setup.py
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/setupapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -100,13 +100,13 @@ jobs:
- name: Install the dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install torch==1.13.1 torchvision==0.14.1
python -m pip install -r requirements-dev.txt
- name: Run quick tests CPU ubuntu
run: |
python -m pip list
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
BUILD_MONAI=1 ./runtests.sh --build --quick --unittests --disttests
BUILD_MONAI=0 ./runtests.sh --build --quick --unittests --disttests
BUILD_MONAI=1 ./runtests.sh --build --quick --min
coverage xml --ignore-errors
- name: Upload coverage
uses: codecov/codecov-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ tests/testing_data/endo.mp4
tests/testing_data/ultrasound.avi
tests/testing_data/train_data_stats.yaml
tests/testing_data/eval_data_stats.yaml
tests/testing_data/train_data_stats_by_case.yaml
tests/testing_data/eval_data_stats_by_case.yaml
tests/testing_data/CT_2D_head_fixed.mha
tests/testing_data/CT_2D_head_moving.mha

Expand Down
15 changes: 10 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ repos:
hooks:
- id: pyupgrade
args: [--py37-plus]
name: Upgrade code
name: Upgrade code excluding monai networks
exclude: |
(?x)^(
versioneer.py|
monai/_version.py
)$
(?x)(
^versioneer.py|
^monai/_version.py|
^monai/networks/ # no PEP 604 for torchscript tensorrt
)
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]
name: Upgrade monai networks
files: (?x)(^monai/networks/)

- repo: https://github.com/asottile/yesqa
rev: v1.4.0
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sphinx:

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
version: 3
install:
- requirements: docs/requirements.txt
# system_packages: true
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ or (for new features that would not break existing functionality):
```

It is recommended that the new test `test_[module_name].py` is constructed by using only
python 3.7+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
python 3.8+ build-in functions, `torch`, `numpy`, `coverage` (for reporting code coverages) and `parameterized` (for organising test cases) packages.
If it requires any other external packages, please make sure:
- the packages are listed in [`requirements-dev.txt`](requirements-dev.txt)
- the new test `test_[module_name].py` is added to the `exclude_cases` in [`./tests/min_tests.py`](./tests/min_tests.py) so that
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# To build with a different base image
# please run `docker build` using the `--build-arg PYTORCH_IMAGE=...` flag.
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:22.12-py3
ARG PYTORCH_IMAGE=nvcr.io/nvidia/pytorch:23.02-py3
FROM ${PYTORCH_IMAGE}

LABEL maintainer="[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion docs/images/python.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-f https://download.pytorch.org/whl/cpu/torch-1.12.1%2Bcpu-cp37-cp37m-linux_x86_64.whl
torch>=1.8
torch>=1.9
pytorch-ignite==0.4.11
numpy>=1.20
itk>=5.2
Expand Down
8 changes: 7 additions & 1 deletion docs/source/apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,13 @@ FastMRIReader

`auto3dseg`
-----------

.. automodule:: monai.apps.auto3dseg
:members:
:imported-members:

`nnUNet`
--------
.. automodule:: monai.apps.nnunet.__main__

.. autoclass:: monai.apps.nnunet.nnUNetV2Runner
:members:
1 change: 1 addition & 0 deletions docs/source/bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Model Bundle
`Scripts`
---------
.. autofunction:: ckpt_export
.. autofunction:: trt_export
.. autofunction:: download
.. autofunction:: load
.. autofunction:: get_all_bundles_list
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

---

MONAI's core functionality is written in Python 3 (>= 3.7) and only requires [Numpy](https://numpy.org/) and [Pytorch](https://pytorch.org/).
MONAI's core functionality is written in Python 3 (>= 3.8) and only requires [Numpy](https://numpy.org/) and [Pytorch](https://pytorch.org/).

The package is currently distributed via Github as the primary source code repository,
and the Python package index (PyPI). The pre-built Docker images are made available on DockerHub.
Expand Down
11 changes: 11 additions & 0 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ Generic Interfaces
.. autoclass:: RandomOrder
:members:

`SomeOf`
^^^^^^^^^^^^^
.. autoclass:: SomeOf
:members:

Functionals
-----------

Expand Down Expand Up @@ -2206,3 +2211,9 @@ Utilities

.. automodule:: monai.transforms.utils_pytorch_numpy_unification
:members:

Lazy
----
.. automodule:: monai.transforms.lazy
:members:
:imported-members:
2 changes: 1 addition & 1 deletion environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ channels:
- conda-forge
dependencies:
- numpy>=1.20
- pytorch>=1.8
- pytorch>=1.9
- torchvision
- pytorch-cuda=11.6
- pip
Expand Down
3 changes: 2 additions & 1 deletion monai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ._version import get_versions

PY_REQUIRED_MAJOR = 3
PY_REQUIRED_MINOR = 7
PY_REQUIRED_MINOR = 8

version_dict = get_versions()
__version__: str = version_dict.get("version", "0+unknown")
Expand Down Expand Up @@ -50,6 +50,7 @@
"(^(monai._C))",
"(.*(__main__)$)",
"(.*(video_dataset)$)",
"(.*(nnunet).*$)",
]
)

Expand Down
Loading

0 comments on commit 303a1a8

Please sign in to comment.