Skip to content

Commit fe6121f

Browse files
authored
Merge branch 'master' into feat/device_name
2 parents 724a01c + b7ca4d3 commit fe6121f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1160
-795
lines changed

.actions/assistant.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,25 @@ def generate_docker_tags(
459459
tags = [f"{docker_project}:{tag}" for tag in tags]
460460
print(",".join(tags))
461461

462+
@staticmethod
463+
def prune_pytest_as_errors(
464+
pyproject_toml: str = "pyproject.toml", errors: tuple = ("FutureWarning", "DeprecationWarning")
465+
) -> None:
466+
"""Prune pytest warnings as errors from the pyproject.toml file."""
467+
import tomlkit
468+
469+
with open(pyproject_toml, encoding="utf-8") as fopen:
470+
content = fopen.read()
471+
pyproject = tomlkit.parse(content)
472+
filterwarnings = pyproject.get("tool", {}).get("pytest", {}).get("ini_options", {}).get("filterwarnings", [])
473+
if not filterwarnings:
474+
return
475+
filterwarnings = [wrn for wrn in filterwarnings if not any(f"error::{err}" in wrn for err in errors)]
476+
pyproject["tool"]["pytest"]["ini_options"]["filterwarnings"] = filterwarnings
477+
478+
with open(pyproject_toml, "w", encoding="utf-8") as fopen:
479+
fopen.write(tomlkit.dumps(pyproject))
480+
462481

463482
if __name__ == "__main__":
464483
import jsonargparse

.azure/gpu-benchmarks.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ jobs:
100100
workingDirectory: tests/
101101
displayName: "Testing: benchmarks"
102102

103-
- bash: bash run_standalone_tasks.sh
103+
- bash: |
104+
bash run_standalone_tasks.sh cpu
105+
bash run_standalone_tasks.sh cuda
104106
workingDirectory: tests/parity_fabric
105107
# without succeeded this could run even if the job has already failed
106108
condition: and(succeeded(), eq(variables['PACKAGE_NAME'], 'fabric'))

.azure/gpu-tests-pytorch.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# Python package
2-
# Create and test a Python package on multiple Python versions.
3-
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4-
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5-
61
trigger:
72
tags:
83
include: ["*"]
@@ -24,18 +19,18 @@ pr:
2419
- "examples/run_pl_examples.sh"
2520
- "examples/pytorch/basics/backbone_image_classifier.py"
2621
- "examples/pytorch/basics/autoencoder.py"
22+
- "requirements/fabric/**"
2723
- "requirements/pytorch/**"
2824
- "src/lightning/__init__.py"
2925
- "src/lightning/__setup__.py"
3026
- "src/lightning/__version__.py"
31-
- "src/lightning/pytorch/**"
27+
- "src/lightning_fabric/*"
28+
- "src/lightning/fabric/**"
3229
- "src/pytorch_lightning/*"
30+
- "src/lightning/pytorch/**"
3331
- "tests/tests_pytorch/**"
3432
- "tests/run_standalone_*.sh"
3533
- "pyproject.toml" # includes pytest config
36-
- "requirements/fabric/**"
37-
- "src/lightning/fabric/**"
38-
- "src/lightning_fabric/*"
3934
exclude:
4035
- "requirements/*/docs.txt"
4136
- "*.md"

.github/checkgroup.yml

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ subprojects:
2121
checks:
2222
- "pl-cpu-guardian" # aggregated check for all cases
2323

24-
- id: "pytorch_lightning: Azure GPU"
24+
- id: "pytorch_lightning: lit GPU"
2525
paths:
2626
- ".actions/*"
27-
- ".azure/gpu-tests-pytorch.yml"
27+
- ".lightning/workflows/pytorch.yml"
2828
# only the azure GPU workflow runs the examples
2929
# all examples don't need to be added because they aren't used in CI, but these are
3030
- "examples/run_pl_examples.sh"
@@ -47,13 +47,13 @@ subprojects:
4747
- "!*.md"
4848
- "!**/*.md"
4949
checks:
50-
- "pytorch-lightning (GPUs) (testing Lightning | latest)"
51-
- "pytorch-lightning (GPUs) (testing PyTorch | oldest)"
52-
- "pytorch-lightning (GPUs) (testing PyTorch | latest)"
50+
- "pytorch.yml / Lit Job (nvidia/cuda:12.1.1-runtime-ubuntu22.04, pytorch, 3.10, A100_X_2)"
51+
- "pytorch.yml / Lit Job (nvidia/cuda:12.6.3-runtime-ubuntu22.04, lightning, 3.12, L4_X_2)"
52+
- "pytorch.yml / Lit Job (nvidia/cuda:12.6.3-runtime-ubuntu22.04, pytorch, 3.12, L4_X_2)"
5353

54-
- id: "pytorch_lightning: Benchmarks"
54+
- id: "Benchmarks"
5555
paths:
56-
- ".azure/gpu-benchmarks.yml"
56+
- ".lightning/workflows/benchmark.yml"
5757
- "requirements/fabric/**"
5858
- "requirements/pytorch/**"
5959
- "src/lightning/fabric/**"
@@ -65,7 +65,8 @@ subprojects:
6565
- "!*.md"
6666
- "!**/*.md"
6767
checks:
68-
- "lightning.Benchmarks"
68+
- "benchmark.yml / Lit Job (fabric)"
69+
- "benchmark.yml / Lit Job (pytorch)"
6970

7071
# Temporarily disabled
7172
# - id: "pytorch-lightning: TPU workflow"
@@ -111,34 +112,6 @@ subprojects:
111112
- "docs-make (pytorch, doctest)"
112113
- "docs-make (pytorch, html)"
113114

114-
- id: "pytorch_lightning: Docker"
115-
paths:
116-
- ".actions/*"
117-
- ".github/workflows/docker-build.yml"
118-
- "dockers/**"
119-
- "requirements/pytorch/**"
120-
- "requirements/fabric/**"
121-
- "setup.py"
122-
- "!requirements/*/docs.txt"
123-
- "!*.md"
124-
- "!**/*.md"
125-
checks:
126-
- "build-cuda (3.10, 2.1.2, 12.1.1)"
127-
- "build-cuda (3.11, 2.2.2, 12.1.1)"
128-
- "build-cuda (3.11, 2.3.1, 12.1.1)"
129-
- "build-cuda (3.11, 2.4.1, 12.1.1)"
130-
- "build-cuda (3.12, 2.5.1, 12.1.1)"
131-
- "build-cuda (3.12, 2.6.0, 12.4.1)"
132-
#- "build-NGC"
133-
- "build-pl (3.10, 2.1, 12.1.1)"
134-
- "build-pl (3.11, 2.2, 12.1.1)"
135-
- "build-pl (3.11, 2.3, 12.1.1)"
136-
- "build-pl (3.11, 2.4, 12.1.1)"
137-
- "build-pl (3.12, 2.5, 12.1.1)"
138-
- "build-pl (3.12, 2.6, 12.4.1)"
139-
- "build-pl (3.12, 2.7, 12.6.3)"
140-
- "build-pl (3.12, 2.8, 12.6.3, true)"
141-
142115
# SECTION: lightning_fabric
143116

144117
- id: "lightning_fabric: CPU workflow"
@@ -156,10 +129,10 @@ subprojects:
156129
checks:
157130
- "fabric-cpu-guardian" # aggregated check for all cases
158131

159-
- id: "lightning_fabric: Azure GPU"
132+
- id: "lightning_fabric: lit GPU"
160133
paths:
161134
- ".actions/*"
162-
- ".azure/gpu-tests-fabric.yml"
135+
- ".lightning/workflows/fabric.yml"
163136
- "examples/fabric/**"
164137
- "examples/run_fabric_examples.sh"
165138
- "requirements/fabric/**"
@@ -175,9 +148,9 @@ subprojects:
175148
- "!*.md"
176149
- "!**/*.md"
177150
checks:
178-
- "lightning-fabric (GPUs) (testing Fabric | oldest)"
179-
- "lightning-fabric (GPUs) (testing Fabric | latest)"
180-
- "lightning-fabric (GPUs) (testing Lightning | latest)"
151+
- "fabric.yml / Lit Job (nvidia/cuda:12.1.1-runtime-ubuntu22.04, fabric, 3.10, A100_X_2)"
152+
- "fabric.yml / Lit Job (nvidia/cuda:12.6.3-runtime-ubuntu22.04, fabric, 3.12, L4_X_2)"
153+
- "fabric.yml / Lit Job (nvidia/cuda:12.6.3-runtime-ubuntu22.04, lightning, 3.12, L4_X_2)"
181154

182155
# Temporarily disabled
183156
# - id: "lightning_fabric: TPU workflow"

.github/label-change.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ package:
5454
- "src/lightning_fabric/*"
5555
- "src/pytorch_lightning/*"
5656

57-
dockers:
58-
- changed-files:
59-
- any-glob-to-any-file:
60-
- "dockers/**"
61-
- ".github/workflows/docker-build.yml"
62-
6357
dependencies:
6458
- changed-files:
6559
- any-glob-to-any-file:

.github/workflows/ci-tests-fabric.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ jobs:
9999
- name: Set min. dependencies
100100
if: ${{ matrix.config.requires == 'oldest' }}
101101
run: |
102-
cd requirements/fabric
103102
uv pip install -U "lightning-utilities[cli]"
104-
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']"
103+
python -m lightning_utilities.cli requirements set-oldest \
104+
--req_files "['requirements/fabric/base.txt', 'requirements/fabric/strategies.txt', 'requirements/fabric/test.txt']"
105105
uv pip install "cython<3.0" wheel
106106
uv pip install "pyyaml==5.4" --no-build-isolation
107+
# This script removes any line containing "error::FutureWarning" from pyproject.toml
108+
uv pip install -r requirements/ci.txt
109+
python .actions/assistant.py prune_pytest_as_errors
107110
108111
- name: Adjust PyTorch versions in requirements files
109112
if: ${{ matrix.config.requires != 'oldest' }}

.github/workflows/ci-tests-pytorch.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,14 @@ jobs:
9898
- name: Set min. dependencies
9999
if: ${{ matrix.config.requires == 'oldest' }}
100100
run: |
101-
cd requirements/pytorch
102101
uv pip install -U "lightning-utilities[cli]"
103-
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']"
102+
python -m lightning_utilities.cli requirements set-oldest \
103+
--req_files "['requirements/pytorch/base.txt', 'requirements/pytorch/extra.txt', 'requirements/pytorch/strategies.txt', 'requirements/pytorch/examples.txt', 'requirements/pytorch/test.txt']"
104104
uv pip install "cython<3.0" wheel
105105
uv pip install "pyyaml==5.4" --no-build-isolation
106+
# This script removes any line containing "error::FutureWarning" from pyproject.toml
107+
uv pip install -r requirements/ci.txt
108+
python .actions/assistant.py prune_pytest_as_errors
106109
107110
- name: Adjust PyTorch versions in requirements files
108111
if: ${{ matrix.config.requires != 'oldest' }}

.github/workflows/code-checks.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,32 @@ jobs:
2929
runs-on: ubuntu-22.04
3030
steps:
3131
- uses: actions/checkout@v5
32-
- uses: actions/setup-python@v6
33-
with:
34-
python-version: "3.11"
3532

36-
- name: Mypy cache
37-
uses: actions/cache@v4
33+
- name: Install uv and set Python version
34+
uses: astral-sh/setup-uv@v6
3835
with:
39-
path: .mypy_cache
40-
key: mypy-${{ hashFiles('requirements/typing.txt') }}
36+
python-version: "3.11"
37+
# TODO: Avoid activating environment like this
38+
# see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
39+
activate-environment: true
40+
enable-cache: true
4141

4242
- name: Install dependencies
4343
env:
4444
FREEZE_REQUIREMENTS: 1
4545
timeout-minutes: 20
4646
run: |
47-
pip install -e '.[pytorch-all,fabric-all]' -r requirements/typing.txt
48-
pip list
47+
uv pip install '.[pytorch-all,fabric-all]' -r requirements/typing.txt
48+
uv pip list
49+
50+
- name: mypy cache
51+
uses: actions/cache@v4
52+
with:
53+
path: .mypy_cache
54+
key: mypy-${{ hashFiles('requirements/typing.txt') }}
4955

5056
- name: Check typing
5157
run: mypy
58+
59+
- name: Minimize uv cache
60+
run: uv cache prune --ci

0 commit comments

Comments
 (0)