Skip to content

PyTorch version tests #1218

PyTorch version tests

PyTorch version tests #1218

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: 45
strategy:
max-parallel: 10
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10"]
pytorch-version:
[1.13.1, 1.12.1, 1.11.0, 1.10.0, 1.9.1, 1.8.1, 1.7.1, 1.6.0, 1.5.1, 1.4.0]
exclude:
- pytorch-version: 1.4.0
python-version: 3.9
- pytorch-version: 1.4.0
python-version: 3.10
- pytorch-version: 1.5.1
python-version: 3.9
- pytorch-version: 1.5.1
python-version: 3.10
- pytorch-version: 1.6.0
python-version: 3.9
- pytorch-version: 1.6.0
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.7.1
python-version: 3.9
- pytorch-version: 1.7.1
python-version: 3.10
- pytorch-version: 1.8.1
python-version: 3.9
- pytorch-version: 1.8.1
python-version: 3.10
- pytorch-version: 1.9.1
python-version: 3.10
- pytorch-version: 1.10.0
python-version: 3.10
- pytorch-version: 1.11.0
python-version: 3.10
steps:
- uses: actions/checkout@v3
- name: Get year & week number
id: get-date
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@v3
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@v2
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Install dependencies
shell: bash -l {0}
if: ${{ matrix.pytorch-version != '1.4.0' }}
run: |
conda install pytorch=${{ matrix.pytorch-version }} torchvision cpuonly python=${{ matrix.python-version }} -c pytorch
pip install -r requirements-dev.txt
python setup.py install
# There is no more torchvision 0.5.0 binaries in anaconda pytorch channel:
# https://anaconda.org/pytorch/torchvision/files
- name: Install appropriate dependencies for PyTorch 1.4.0
shell: bash -l {0}
if: ${{ matrix.pytorch-version == '1.4.0' }}
run: |
conda install pytorch=${{ matrix.pytorch-version }} cpuonly python=${{ matrix.python-version }} -c pytorch
pip install torchvision==0.5.0
pip install -r requirements-dev.txt
python setup.py install
- name: Download MNIST
uses: pytorch-ignite/download-mnist-github-action@master
with:
target_dir: /tmp
- name: Run Tests
shell: bash -l {0}
run: |
bash 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@v3
- 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 }}