From 853bafd5bb3167b932143d362b809a52164927db Mon Sep 17 00:00:00 2001 From: vfdev Date: Fri, 27 Sep 2024 10:52:55 +0200 Subject: [PATCH 1/9] Drop python 3.8 in the CI --- .github/workflows/code-style.yml | 2 +- .github/workflows/hvd-tests.yml | 2 +- .github/workflows/mps-tests.yml | 2 +- .github/workflows/pytorch-version-tests.yml | 2 ++ .github/workflows/unit-tests.yml | 6 +++--- CONTRIBUTING.md | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 8627c0ece64..fe826456c79 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.11" - run: | bash ./tests/run_code_style.sh install bash ./tests/run_code_style.sh fmt diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index 35e107f888b..c0196d1affb 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: [3.8] + python-version: [3.11] pytorch-channel: [pytorch] steps: diff --git a/.github/workflows/mps-tests.yml b/.github/workflows/mps-tests.yml index 4cdd01f5a21..ac63aa725e2 100644 --- a/.github/workflows/mps-tests.yml +++ b/.github/workflows/mps-tests.yml @@ -34,7 +34,7 @@ jobs: mps-tests: strategy: matrix: - python-version: [3.8] + python-version: [3.11] pytorch-channel: ["pytorch"] skip-distrib-tests: [1] fail-fast: false diff --git a/.github/workflows/pytorch-version-tests.yml b/.github/workflows/pytorch-version-tests.yml index f268669158e..0c5a0ae1c48 100644 --- a/.github/workflows/pytorch-version-tests.yml +++ b/.github/workflows/pytorch-version-tests.yml @@ -15,6 +15,8 @@ jobs: max-parallel: 5 fail-fast: false matrix: + # Here we keep python 3.8 tests until the end of the 2024 and + # will drop python version and related pytorch versions python-version: [3.8, 3.9, "3.10"] pytorch-version: [2.3.1, 2.2.2, 2.1.2, 2.0.1, 1.13.1, 1.12.1, 1.10.0, 1.8.1, 1.5.1] diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 0b94e0d0e9e..e88b1003131 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -40,18 +40,18 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] pytorch-channel: [pytorch, pytorch-nightly] include: # includes a single build on windows - os: windows-latest pytorch-channel: pytorch - python-version: 3.9 + python-version: 3.11 skip-distrib-tests: 1 # includes a single build on macosx - os: macos-latest pytorch-channel: pytorch - python-version: 3.9 + python-version: 3.11 skip-distrib-tests: 1 steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd41e6abf86..eabbef21151 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,7 @@ into the following categories: - Create an isolated conda environment for pytorch-ignite: ```bash -conda create -n pytorch-ignite-dev python=3.8 +conda create -n pytorch-ignite-dev python=3.11 ``` - Activate the newly created environment: From 071bf8f8273f2dcbeec6e4bbbaa1b5d4a62eddfc Mon Sep 17 00:00:00 2001 From: vfdev Date: Fri, 27 Sep 2024 11:28:26 +0200 Subject: [PATCH 2/9] Try horovod CPU CI on python 3.10 --- .github/workflows/hvd-tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index 3c14af3bca7..4cd384ab9cd 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -28,7 +28,14 @@ jobs: timeout-minutes: 60 strategy: matrix: - python-version: [3.11] + # Horovod installed on python 3.11 fails with error: + # ignite/distributed/comp_models/horovod.py:159: in _HorovodDistModel + # "SUM": hvd.mpi_ops.Sum, + # E AttributeError: module 'horovod.torch' has no attribute 'mpi_ops' + # Extension horovod.torch has not been built: /opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/horovod/torch/mpi_lib_v2.cpython-311-x86_64-linux-gnu.so not found + # If this is not expected, reinstall Horovod with HOROVOD_WITH_PYTORCH=1 to debug the build error. + # Warning! MPI libs are missing, but python applications are still available. + python-version: [3.10] pytorch-channel: [pytorch] steps: From 37ec5f3d13fef7797bd1914dbcfc6c605b11e957 Mon Sep 17 00:00:00 2001 From: vfdev Date: Fri, 27 Sep 2024 11:29:09 +0200 Subject: [PATCH 3/9] Fix 3.10 -> "3.10" --- .github/workflows/hvd-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index 4cd384ab9cd..e4c90b437c7 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -35,7 +35,7 @@ jobs: # Extension horovod.torch has not been built: /opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/horovod/torch/mpi_lib_v2.cpython-311-x86_64-linux-gnu.so not found # If this is not expected, reinstall Horovod with HOROVOD_WITH_PYTORCH=1 to debug the build error. # Warning! MPI libs are missing, but python applications are still available. - python-version: [3.10] + python-version: ["3.10"] pytorch-channel: [pytorch] steps: From e24d24a7a3f7f2d37c23870d1f0784cd632491a7 Mon Sep 17 00:00:00 2001 From: vfdev Date: Sun, 29 Sep 2024 21:12:09 +0200 Subject: [PATCH 4/9] Update hvd-tests.yml --- .github/workflows/hvd-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index e4c90b437c7..2f490ed6992 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -28,14 +28,14 @@ jobs: timeout-minutes: 60 strategy: matrix: - # Horovod installed on python 3.11 fails with error: + # Horovod installed on python 3.11, 3.10 fails with error: # ignite/distributed/comp_models/horovod.py:159: in _HorovodDistModel # "SUM": hvd.mpi_ops.Sum, # E AttributeError: module 'horovod.torch' has no attribute 'mpi_ops' # Extension horovod.torch has not been built: /opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/horovod/torch/mpi_lib_v2.cpython-311-x86_64-linux-gnu.so not found # If this is not expected, reinstall Horovod with HOROVOD_WITH_PYTORCH=1 to debug the build error. # Warning! MPI libs are missing, but python applications are still available. - python-version: ["3.10"] + python-version: ["3.9"] pytorch-channel: [pytorch] steps: From 3af09515c527dc48f84b65ee178d05399efac1ac Mon Sep 17 00:00:00 2001 From: vfdev Date: Tue, 1 Oct 2024 15:35:15 +0000 Subject: [PATCH 5/9] Build horovod from source --- .github/workflows/hvd-tests.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index 2f490ed6992..f4bd9950073 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -28,14 +28,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - # Horovod installed on python 3.11, 3.10 fails with error: - # ignite/distributed/comp_models/horovod.py:159: in _HorovodDistModel - # "SUM": hvd.mpi_ops.Sum, - # E AttributeError: module 'horovod.torch' has no attribute 'mpi_ops' - # Extension horovod.torch has not been built: /opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/horovod/torch/mpi_lib_v2.cpython-311-x86_64-linux-gnu.so not found - # If this is not expected, reinstall Horovod with HOROVOD_WITH_PYTORCH=1 to debug the build error. - # Warning! MPI libs are missing, but python applications are still available. - python-version: ["3.9"] + python-version: ["3.11"] pytorch-channel: [pytorch] steps: @@ -71,7 +64,7 @@ jobs: #install other dependencies pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu pip install -r requirements-dev.txt - pip install horovod + pip install git+https://github.com/horovod/horovod.git python setup.py install # Download MNIST: https://github.com/pytorch/ignite/issues/1737 From 47e6aed079acac8ef35976e84bcff354b1fe76e7 Mon Sep 17 00:00:00 2001 From: vfdev Date: Tue, 1 Oct 2024 16:17:36 +0000 Subject: [PATCH 6/9] debug with tmate --- .github/workflows/hvd-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index f4bd9950073..5a4e084fbe3 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -33,6 +33,8 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 - name: Get year & week number id: get-date @@ -56,7 +58,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - + - name: Install dependencies shell: bash -l {0} run: | From 51c578cc7fe3ee103f58cf09106d61b23b935c79 Mon Sep 17 00:00:00 2001 From: vfdev Date: Tue, 1 Oct 2024 18:23:40 +0200 Subject: [PATCH 7/9] debug 2 --- .github/workflows/hvd-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index 5a4e084fbe3..e67635b5f95 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -33,8 +33,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - name: Get year & week number id: get-date @@ -59,6 +57,9 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + - name: Install dependencies shell: bash -l {0} run: | From 52267e7b16c3d52e8287e740f6be2b27ab7bc7c5 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 2 Oct 2024 14:53:13 +0200 Subject: [PATCH 8/9] Fixed horovod build --- .github/workflows/hvd-tests.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/hvd-tests.yml b/.github/workflows/hvd-tests.yml index e67635b5f95..9a6d909d3cd 100644 --- a/.github/workflows/hvd-tests.yml +++ b/.github/workflows/hvd-tests.yml @@ -56,9 +56,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - name: Install dependencies shell: bash -l {0} @@ -67,7 +64,20 @@ jobs: #install other dependencies pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu pip install -r requirements-dev.txt - pip install git+https://github.com/horovod/horovod.git + + # Install Horovod from source and apply a patch to build with recent pytorch + # We can't use pip install as build-env can't find pytorch and + # `--no-build-isolation` does not work with horovod setup.py + git clone --recursive https://github.com/horovod/horovod.git /tmp/horovod + cd /tmp/horovod + sed -i "s/CMAKE_CXX_STANDARD 14/CMAKE_CXX_STANDARD 17/g" CMakeLists.txt + sed -i "s/CMAKE_CXX_STANDARD 14/CMAKE_CXX_STANDARD 17/g" horovod/torch/CMakeLists.txt + HOROVOD_WITH_PYTORCH=1 python setup.py install + cd - + # test the installation: + python -c "import horovod.torch as hvd; hvd.mpi_ops.Sum" + + # Install ignite python setup.py install # Download MNIST: https://github.com/pytorch/ignite/issues/1737 From c67050cc770d688ec83d897567c984cfafd6b9c3 Mon Sep 17 00:00:00 2001 From: vfdev Date: Wed, 2 Oct 2024 15:23:03 +0200 Subject: [PATCH 9/9] Fix mypy on neptune import in neptune logger --- ignite/handlers/neptune_logger.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ignite/handlers/neptune_logger.py b/ignite/handlers/neptune_logger.py index 092d1f81574..79157dddbf9 100644 --- a/ignite/handlers/neptune_logger.py +++ b/ignite/handlers/neptune_logger.py @@ -166,15 +166,7 @@ def __setitem__(self, key: str, val: Any) -> Any: def __init__(self, api_token: Optional[str] = None, project: Optional[str] = None, **kwargs: Any) -> None: try: - try: - # neptune-client<1.0.0 package structure - with warnings.catch_warnings(): - # ignore the deprecation warnings - warnings.simplefilter("ignore") - import neptune.new as neptune - except ImportError: - # neptune>=1.0.0 package structure - import neptune + import neptune except ImportError: raise ModuleNotFoundError( "This contrib module requires the Neptune client library to be installed. "