File: tests.yml

package info (click to toggle)
pytorch-vision 0.24.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 21,844 kB
  • sloc: python: 70,433; cpp: 11,502; ansic: 2,588; java: 550; sh: 317; xml: 79; objc: 56; makefile: 33
file content (181 lines) | stat: -rw-r--r-- 5,260 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Tests

on:
  pull_request:
  push:
    branches:
      - nightly
      - main
      - release/*
  workflow_dispatch:

jobs:
  unittests-linux:
    strategy:
      matrix:
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
        runner: ["linux.12xlarge"]
        gpu-arch-type: ["cpu"]
        include:
          - python-version: "3.10"
            runner: linux.g5.4xlarge.nvidia.gpu
            gpu-arch-type: cuda
            gpu-arch-version: "12.6"
      fail-fast: false
    uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.9
    permissions:
      id-token: write
      contents: read
    with:
      repository: pytorch/vision
      runner: ${{ matrix.runner }}
      gpu-arch-type: ${{ matrix.gpu-arch-type }}
      gpu-arch-version: ${{ matrix.gpu-arch-version }}
      timeout: 120
      test-infra-ref: release/2.9
      script: |
        set -euo pipefail

        export PYTHON_VERSION=${{ matrix.python-version }}
        export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
        export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}

        ./.github/scripts/unittest.sh

  unittests-macos:
    strategy:
      matrix:
        python-version:
          - "3.10"
          # TODO put back 3.11 (See blame)
          # - "3.11"
          - "3.12"
        runner: ["macos-m1-stable"]
      fail-fast: false
    uses: pytorch/test-infra/.github/workflows/macos_job.yml@release/2.9
    with:
      repository: pytorch/vision
      timeout: 240
      runner: ${{ matrix.runner }}
      test-infra-ref: release/2.9
      script: |
        set -euo pipefail

        export PYTHON_VERSION=${{ matrix.python-version }}
        export GPU_ARCH_TYPE=cpu
        export GPU_ARCH_VERSION=''

        ${CONDA_RUN} ./.github/scripts/unittest.sh

  unittests-windows:
    strategy:
      matrix:
        python-version:
          - "3.10"
          - "3.11"
          - "3.12"
        runner: ["windows.4xlarge"]
        gpu-arch-type: ["cpu"]
        # TODO: put GPU testing back
        # include:
        #   - python-version: "3.9"
        #     runner: windows.g5.4xlarge.nvidia.gpu
        #     gpu-arch-type: cuda
        #     gpu-arch-version: "11.8"
      fail-fast: false
    uses: pytorch/test-infra/.github/workflows/windows_job.yml@release/2.9
    permissions:
      id-token: write
      contents: read
    with:
      repository: pytorch/vision
      runner: ${{ matrix.runner }}
      gpu-arch-type: ${{ matrix.gpu-arch-type }}
      gpu-arch-version: ${{ matrix.gpu-arch-version }}
      timeout: 120
      test-infra-ref: release/2.9
      script: |
        set -euxo pipefail

        export PYTHON_VERSION=${{ matrix.python-version }}
        export VC_YEAR=2022
        export VSDEVCMD_ARGS=""
        export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
        export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}

        ./.github/scripts/unittest.sh

  # onnx:
  #   uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.9
  #   permissions:
  #     id-token: write
  #     contents: read
  #   with:
  #     repository: pytorch/vision
  #     test-infra-ref: release/2.9
  #     script: |
  #       set -euo pipefail

  #       export PYTHON_VERSION=3.10
  #       export GPU_ARCH_TYPE=cpu
  #       export GPU_ARCH_VERSION=''

  #       ./.github/scripts/setup-env.sh

  #       # Prepare conda
  #       CONDA_PATH=$(which conda)
  #       eval "$(${CONDA_PATH} shell.bash hook)"
  #       conda activate ci

  #       echo '::group::Install ONNX'
  #       pip install --progress-bar=off onnx onnxruntime
  #       echo '::endgroup::'

  #       echo '::group::Install testing utilities'
  #       pip install --progress-bar=off pytest "numpy<2"
  #       echo '::endgroup::'

  #       echo '::group::Run ONNX tests'
  #       pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_onnx.py
  #       echo '::endgroup::'

  unittests-extended:
    uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.9
    permissions:
      id-token: write
      contents: read
    if: contains(github.event.pull_request.labels.*.name, 'run-extended')
    with:
      repository: pytorch/vision
      test-infra-ref: release/2.9
      script: |
        set -euo pipefail

        export PYTHON_VERSION="3.10"
        export GPU_ARCH_TYPE=cpu
        export GPU_ARCH_VERSION=''

        ./.github/scripts/setup-env.sh

        # Prepare conda
        CONDA_PATH=$(which conda)
        eval "$(${CONDA_PATH} shell.bash hook)"
        conda activate ci

        echo '::group::Pre-download model weights'
        pip install --progress-bar=off aiohttp aiofiles tqdm
        python scripts/download_model_urls.py
        echo '::endgroup::'

        echo '::group::Install testing utilities'
        # TODO: remove the <8 constraint on pytest when https://github.com/pytorch/vision/issues/8238 is closed
        pip install --progress-bar=off "pytest<8"
        echo '::endgroup::'

        echo '::group::Run extended unittests'
        export PYTORCH_TEST_WITH_EXTENDED=1
        pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 test/test_extended_*.py
        echo '::endgroup::'