Skip to content

Commit

Permalink
Merge branch 'master' into cocomap
Browse files Browse the repository at this point in the history
  • Loading branch information
sadra-barikbin authored Oct 5, 2024
2 parents 954d130 + 302c707 commit d2978cf
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/hvd-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
timeout-minutes: 60
strategy:
matrix:
python-version: [3.8]
python-version: ["3.11"]
pytorch-channel: [pytorch]

steps:
Expand Down Expand Up @@ -64,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 horovod
# Install Horovod from source and apply a patch to build with recent pytorch
# We can't use pip install <whatever> 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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mps-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/pytorch-version-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ 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]
[2.3.1, 2.2.2, 2.1.2, 2.0.1, 1.13.1, 1.12.1, 1.10.0, 1.8.1]
exclude:
- pytorch-version: 1.5.1
python-version: 3.9
- pytorch-version: 1.5.1
python-version: "3.10"

# disabling python 3.9 support with PyTorch 1.7.1 and 1.8.1, to stop repeated pytorch-version test fail.
# https://github.com/pytorch/ignite/issues/2383
- pytorch-version: 1.8.1
Expand Down Expand Up @@ -72,6 +69,13 @@ jobs:
shell: bash -l {0}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly python=${{ matrix.python-version }} -c pytorch
# We should install numpy<2.0 for pytorch<2.3
numpy_one_pth_version=$(python -c "import torch; print(float('.'.join(torch.__version__.split('.')[:2])) < 2.3)")
if [ "${numpy_one_pth_version}" == "True" ]; then
pip install -U "numpy<2.0"
fi
pip install -r requirements-dev.txt
python setup.py install
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 1 addition & 9 deletions ignite/handlers/neptune_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. "
Expand Down
1 change: 1 addition & 0 deletions ignite/metrics/hsic.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def update(self, output: Sequence[Tensor]) -> None:

vx: Union[Tensor, float]
if self.sigma_x < 0:
# vx = torch.quantile(dxx, 0.5)
vx = torch.quantile(dxx, 0.5)
else:
vx = self.sigma_x**2
Expand Down
3 changes: 2 additions & 1 deletion tests/ignite/metrics/test_hsic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
from typing import Tuple

import numpy as np
Expand Down Expand Up @@ -74,7 +75,7 @@ def test_case(request) -> Tuple[Tensor, Tensor, int]:
N = 200
b = 20
x = torch.randn(N, 5)
y = x @ torch.normal(0.0, torch.pi, size=(5, 3))
y = x @ torch.normal(0.0, math.pi, size=(5, 3))
y = (
torch.stack([torch.sin(y[:, 0]), torch.cos(y[:, 1]), torch.exp(y[:, 2])], dim=1)
+ torch.randn_like(y) * 1e-4
Expand Down

0 comments on commit d2978cf

Please sign in to comment.