@@ -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,30 +75,34 @@ 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
98
85
86
+ - name : Append Env. vars for Linux
87
+ if : ${{ runner.os == 'Linux' }}
88
+ run : echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV
89
+
99
90
- name : Set min. dependencies
100
- if : ${{ matrix.requires == 'oldest' }}
91
+ if : ${{ matrix.config. requires == 'oldest' }}
101
92
run : |
102
93
cd requirements/pytorch
103
94
pip install -U "lightning-utilities[cli]"
104
- python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt']"
95
+ python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt' ]"
105
96
pip install "cython<3.0" wheel
106
97
pip install "pyyaml==5.4" --no-build-isolation
107
98
108
99
- name : Adjust PyTorch versions in requirements files
109
- if : ${{ matrix.requires != 'oldest' }}
100
+ if : ${{ matrix.config. requires != 'oldest' }}
110
101
run : |
111
102
pip install -q -r requirements/ci.txt
112
103
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
113
104
for fpath in `ls requirements/**/*.txt`; do \
114
- python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
105
+ python ./adjust-torch-versions.py $fpath ${{ matrix.config. pytorch-version }}; \
115
106
done
116
107
cat requirements/pytorch/base.txt
117
108
@@ -127,28 +118,30 @@ jobs:
127
118
- name : Env. variables
128
119
run : |
129
120
# 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
121
+ 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
122
# Switch coverage scope
132
- python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
123
+ python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config. pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
133
124
# 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
125
+ python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config. pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
135
126
# 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
127
+ python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.config. pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
137
128
138
129
- name : Install package & dependencies
139
130
timeout-minutes : 20
140
131
run : |
141
132
pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
142
133
-U --upgrade-strategy=eager --prefer-binary \
143
134
-r requirements/_integrations/accelerators.txt \
144
- --extra-index-url="${TORCH_URL}" --find-links="${PYPI_CACHE_DIR}" --find-links="https://download.pytorch.org/whl/torch-tensorrt"
135
+ --extra-index-url="${TORCH_URL}" \
136
+ --find-links="${PYPI_CACHE_DIR}" \
137
+ --find-links="https://download.pytorch.org/whl/torch-tensorrt"
145
138
pip list
146
139
- name : Drop LAI from extensions
147
- if : ${{ matrix.pkg-name != 'lightning' }}
140
+ if : ${{ matrix.config. pkg-name != 'lightning' }}
148
141
# Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
149
142
run : pip uninstall -y lightning
150
143
- name : Drop PL for LAI
151
- if : ${{ matrix.pkg-name == 'lightning' }}
144
+ if : ${{ matrix.config. pkg-name == 'lightning' }}
152
145
run : pip uninstall -y pytorch-lightning
153
146
- name : Dump handy wheels
154
147
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
@@ -169,10 +162,10 @@ jobs:
169
162
run : |
170
163
set -e
171
164
python requirements/pytorch/check-avail-extras.py
172
- python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.pytorch-version }}'), ver"
165
+ python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.config. pytorch-version }}'), ver"
173
166
174
167
- name : Adjust tests / env. -> PL
175
- if : ${{ matrix.pkg-name != 'lightning' }}
168
+ if : ${{ matrix.config. pkg-name != 'lightning' }}
176
169
run : |
177
170
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
178
171
--source_import="lightning.fabric,lightning.pytorch" \
@@ -222,7 +215,7 @@ jobs:
222
215
with :
223
216
token : ${{ secrets.CODECOV_TOKEN }}
224
217
file : tests/tests_pytorch/coverage.xml
225
- flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.python-version }},pytorch${{ matrix.pytorch-version }}
218
+ flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.config. python-version }},pytorch${{ matrix.config .pytorch-version }}
226
219
name : CPU-coverage
227
220
fail_ci_if_error : false
228
221
0 commit comments