@@ -42,42 +42,29 @@ jobs:
42
42
strategy :
43
43
fail-fast : false
44
44
matrix :
45
- include :
45
+ os : [macOS-14, ubuntu-22.04, windows-2022]
46
+ config :
46
47
# only run PyTorch latest
47
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
48
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
49
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
50
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
51
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
52
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
53
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
54
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
55
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
56
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
57
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
58
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
59
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
60
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
61
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
48
+ - { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
49
+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
50
+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
51
+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
52
+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
53
+
62
54
# only run PyTorch latest with Python latest, use PyTorch scope to limit dependency issues
63
- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
64
- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
65
- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
66
- # "oldest" versions tests, only on minimum Python
67
- - { os: "macOS-14", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
68
- - { os: "ubuntu-22.04", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
69
- - { os: "windows-2022", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
55
+ - { pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
56
+
70
57
# "pytorch" installs the standalone package
71
- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
72
- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
73
- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
58
+ - { pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
59
+
74
60
# adding recently cut Torch 2.7 - FUTURE
75
- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
76
- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
77
- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
61
+ - { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
62
+
63
+ # "oldest" versions tests, only on minimum Python
64
+ - { pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
78
65
timeout-minutes : 50
79
66
env :
80
- PACKAGE_NAME : ${{ matrix.pkg-name }}
67
+ PACKAGE_NAME : ${{ matrix.config. pkg-name }}
81
68
TORCH_URL : " https://download.pytorch.org/whl/cpu/"
82
69
TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
83
70
TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
@@ -88,10 +75,10 @@ jobs:
88
75
steps :
89
76
- uses : actions/checkout@v5
90
77
91
- - name : Set up Python ${{ matrix.python-version }}
78
+ - name : Set up Python ${{ matrix.config. python-version }}
92
79
uses : actions/setup-python@v5
93
80
with :
94
- python-version : ${{ matrix.python-version || '3.9' }}
81
+ python-version : ${{ matrix.config. python-version || '3.9' }}
95
82
96
83
- name : basic setup
97
84
run : pip install -q -r .actions/requirements.txt
111
98
pip install -q -r requirements/ci.txt
112
99
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
113
100
for fpath in `ls requirements/**/*.txt`; do \
114
- python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
101
+ python ./adjust-torch-versions.py $fpath ${{ matrix.config. pytorch-version }}; \
115
102
done
116
103
cat requirements/pytorch/base.txt
117
104
@@ -127,13 +114,13 @@ jobs:
127
114
- name : Env. variables
128
115
run : |
129
116
# Switch PyTorch URL between stable and test/future
130
- python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
117
+ python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.config. pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
131
118
# Switch coverage scope
132
- python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
119
+ python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config. pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
133
120
# if you install mono-package set dependency only for this subpackage
134
- python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
121
+ python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config. pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
135
122
# Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
136
- python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
123
+ python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.config. pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
137
124
138
125
- name : Install package & dependencies
139
126
timeout-minutes : 20
@@ -146,11 +133,11 @@ jobs:
146
133
--find-links="https://download.pytorch.org/whl/torch-tensorrt"
147
134
pip list
148
135
- name : Drop LAI from extensions
149
- if : ${{ matrix.pkg-name != 'lightning' }}
136
+ if : ${{ matrix.config. pkg-name != 'lightning' }}
150
137
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
151
138
run : pip uninstall -y lightning
152
139
- name : Drop PL for LAI
153
- if : ${{ matrix.pkg-name == 'lightning' }}
140
+ if : ${{ matrix.config. pkg-name == 'lightning' }}
154
141
run : pip uninstall -y pytorch-lightning
155
142
- name : Dump handy wheels
156
143
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
@@ -171,10 +158,10 @@ jobs:
171
158
run : |
172
159
set -e
173
160
python requirements/pytorch/check-avail-extras.py
174
- python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.pytorch-version }}'), ver"
161
+ python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.config. pytorch-version }}'), ver"
175
162
176
163
- name : Adjust tests / env. -> PL
177
- if : ${{ matrix.pkg-name != 'lightning' }}
164
+ if : ${{ matrix.config. pkg-name != 'lightning' }}
178
165
run : |
179
166
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
180
167
--source_import="lightning.fabric,lightning.pytorch" \
@@ -224,7 +211,7 @@ jobs:
224
211
with :
225
212
token : ${{ secrets.CODECOV_TOKEN }}
226
213
file : tests/tests_pytorch/coverage.xml
227
- flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.python-version }},pytorch${{ matrix.pytorch-version }}
214
+ flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.config. python-version }},pytorch${{ matrix.config .pytorch-version }}
228
215
name : CPU-coverage
229
216
fail_ci_if_error : false
230
217
0 commit comments