Skip to content

Commit 0685799

Browse files
authored
Merge branch 'master' into weights-only-compatibility
2 parents ea6773e + cd30ce4 commit 0685799

File tree

13 files changed

+126
-33
lines changed

13 files changed

+126
-33
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

.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

requirements/ci.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ importlib-metadata <9.0.0
66
wget
77
pkginfo ==1.12.1.2
88
packaging <25.1
9+
tomlkit

requirements/fabric/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
coverage ==7.10.6
22
numpy >=1.21.0, <1.27.0
33
pytest ==8.4.2
4-
pytest-cov ==6.2.1
4+
pytest-cov ==6.3.0
55
pytest-timeout ==2.4.0
66
pytest-rerunfailures ==16.0.1
77
pytest-random-order ==1.2.0

requirements/pytorch/examples.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
requests <2.33.0
55
torchvision >=0.16.0, <0.24.0
6-
ipython[all] >=8.0.0, <9.0.0
6+
ipython[all] >=8.0.0, <10.0.0
77
torchmetrics >=0.10.0, <1.9.0

requirements/pytorch/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
coverage ==7.10.6
22
pytest ==8.4.2
3-
pytest-cov ==6.2.1
3+
pytest-cov ==6.3.0
44
pytest-timeout ==2.4.0
55
pytest-rerunfailures ==16.0.1
66
pytest-random-order ==1.2.0

src/lightning/fabric/CHANGELOG.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,30 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
2424
- let `_get_default_process_group_backend_for_device` support more hardware platforms ([#21057](https://github.com/Lightning-AI/pytorch-lightning/pull/21057), [#21093](https://github.com/Lightning-AI/pytorch-lightning/pull/21093))
2525

2626

27-
### Fixed
27+
- Set `_DeviceDtypeModuleMixin._device` from torch's default device function ([#21164](https://github.com/Lightning-AI/pytorch-lightning/pull/21164))
2828

29-
- Fixed with adding a missing device id for pytorch 2.8 ([#21105](https://github.com/Lightning-AI/pytorch-lightning/pull/21105))
3029

30+
### Fixed
3131

32-
- Respect `verbose=False` in `seed_everything` when no seed is provided
32+
-
3333

3434

3535
---
3636

37+
## [2.5.5] - 2025-09-05
38+
39+
### Changed
40+
41+
- Include `exclude_frozen_parameters` to `DeepSpeedStrategy` ([#21060](https://github.com/Lightning-AI/pytorch-lightning/pull/21060))
42+
- Let `_get_default_process_group_backend_for_device` support more hardware platforms (
43+
[#21057](https://github.com/Lightning-AI/pytorch-lightning/pull/21057), [#21093](https://github.com/Lightning-AI/pytorch-lightning/pull/21093))
44+
45+
### Fixed
46+
47+
- Fixed with adding a missing device id for pytorch 2.8 ([#21105](https://github.com/Lightning-AI/pytorch-lightning/pull/21105))
48+
- Respecting `verbose=False` in `seed_everything` when no seed is provided ([#21161](https://github.com/Lightning-AI/pytorch-lightning/pull/21161))
49+
50+
3751
## [2.5.4] - 2025-08-29
3852

3953
### Changed

src/lightning/fabric/utilities/device_dtype_mixin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@
1818
from torch.nn import Module
1919
from typing_extensions import Self, override
2020

21+
from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_3
22+
2123

2224
class _DeviceDtypeModuleMixin(Module):
2325
__jit_unused_properties__: list[str] = ["device", "dtype"]
2426

2527
def __init__(self) -> None:
2628
super().__init__()
2729
self._dtype: Union[str, torch.dtype] = torch.get_default_dtype()
28-
self._device = torch.device("cpu")
30+
# Workarounds from the original pytorch issue:
31+
# https://github.com/pytorch/pytorch/issues/115333#issuecomment-1848449687
32+
self._device = torch.get_default_device() if _TORCH_GREATER_EQUAL_2_3 else torch.empty(0).device
2933

3034
@property
3135
def dtype(self) -> Union[str, torch.dtype]:

0 commit comments

Comments
 (0)