Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 16 additions & 45 deletions .github/workflows/pytorch-version-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,15 @@ jobs:
max-parallel: 5
fail-fast: false
matrix:
python-version: [3.9, "3.10", "3.11"]
pytorch-version: [2.5.1, 2.4.1, 2.3.1, 2.2.2, 1.13.1, 1.12.1, 1.10.0]
python-version: ["3.10", "3.11", "3.12"]
pytorch-version: [2.7.1, 2.5.1, 2.4.1, 2.3.1, 1.13.1]
exclude:
- pytorch-version: 1.10.0
python-version: "3.10"
- pytorch-version: 1.10.0
python-version: "3.11"

- pytorch-version: 1.11.0
python-version: "3.10"
- pytorch-version: 1.11.0
python-version: "3.11"
- pytorch-version: 1.12.1
python-version: "3.11"
# Conda fails to install cpuonly version and few cpu distributed tests are
# failing with unrelated errors
- pytorch-version: 1.13.1
python-version: "3.11"
- pytorch-version: 1.13.1
python-version: "3.12"

steps:
- uses: actions/checkout@v5
Expand All @@ -42,50 +33,30 @@ jobs:
run: echo "date=$(/bin/date "+%Y-%U")" >> $GITHUB_OUTPUT
shell: bash -l {0}

- name: Get pip cache dir
id: pip-cache
run: |
python3 -m pip install -U pip
echo "pip_cache=$(python3 -m pip cache dir)" >> $GITHUB_OUTPUT
shell: bash -l {0}

- uses: actions/cache@v4
with:
path: |
~/conda_pkgs_dir
${{ steps.pip-cache.outputs.pip_cache }}
key: ${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-version }}-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-version }}-

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
- uses: astral-sh/setup-uv@v6
with:
miniconda-version: "latest"
version: "latest"
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
activate-environment: true
enable-cache: true
cache-suffix: "${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-version }}"
cache-dependency-glob: |
**/requirements-dev.txt
**/pyproject.toml

- name: Install dependencies
shell: bash -l {0}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly python=${{ matrix.python-version }} -c pytorch
uv pip install "torch==${{ matrix.pytorch-version }}" torchvision --index-url https://download.pytorch.org/whl/cpu

# 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"
uv pip install -U "numpy<2.0"
fi

pip install -r requirements-dev.txt
pip install .

# pytorch>=1.9.0,<1.11.0 is using "from setuptools import distutils; distutils.version.LooseVersion" anti-pattern
# which raises the error: AttributeError: module 'distutils' has no attribute 'version' for setuptools>59
bad_pth_version=$(python -c "import torch; print('.'.join(torch.__version__.split('.')[:2]) in ['1.9', '1.10'])")
if [ "${bad_pth_version}" == "True" ]; then
pip install --upgrade "setuptools<59"
python -c "from setuptools import distutils; distutils.version.LooseVersion"
fi
uv pip install -r requirements-dev.txt
uv pip install .

- name: Download MNIST
uses: pytorch-ignite/download-mnist-github-action@master
Expand Down
Loading