Skip to content

PyTorch version tests #2094

PyTorch version tests

PyTorch version tests #2094

name: PyTorch version tests
on:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#onschedule
schedule:
# Run at 00:00 UTC Every Day
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 85
strategy:
max-parallel: 5
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
pytorch-version: [2.7.1, 2.5.1, 2.4.1, 2.3.1, 2.2.2]
# exclude:
# - pytorch-version: 2.2.2
# python-version: "3.12"
steps:
- uses: actions/checkout@v5
- name: Get year & week number
id: get-date
run: echo "date=$(/bin/date "+%Y-%U")" >> $GITHUB_OUTPUT
shell: bash -l {0}
- uses: astral-sh/setup-uv@v6
with:
version: "latest"
python-version: ${{ matrix.python-version }}
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: |
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
uv pip install -U "numpy<2.0"
fi
uv pip install -r requirements-dev.txt
uv pip install .
- name: Download MNIST
uses: pytorch-ignite/download-mnist-github-action@master
with:
target_dir: /tmp
- name: Run Tests
uses: nick-fields/[email protected]
with:
max_attempts: 5
timeout_minutes: 15
shell: bash
command: bash -l tests/run_cpu_tests.sh "not test_time_profilers"
new_command_on_retry: USE_LAST_FAILED=1 bash -l tests/run_cpu_tests.sh "not test_time_profilers"
# create-issue:
# runs-on: ubuntu-latest
# # https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
# needs: build
# if: always() && needs.build.result == 'failure'
# steps:
# - uses: actions/checkout@v5
# - uses: JasonEtco/create-an-issue@v2
# name: Create issue if pytorch version tests failed
# with:
# filename: .github/failed_schedule_issue_template.md
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}