Skip to content

Commit 09097ee

Browse files
committed
Merge branch 'master' into cgebbe-wandb-all-checkpoints
2 parents 25bd9d7 + 96df8c4 commit 09097ee

File tree

542 files changed

+5137
-2934
lines changed

Some content is hidden

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

542 files changed

+5137
-2934
lines changed

.actions/assistant.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
import shutil
1919
import tempfile
2020
import urllib.request
21+
from collections.abc import Iterable, Iterator, Sequence
2122
from itertools import chain
2223
from os.path import dirname, isfile
2324
from pathlib import Path
24-
from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Tuple
25+
from typing import Any, Optional
2526

2627
from packaging.requirements import Requirement
2728
from packaging.version import Version
@@ -127,7 +128,7 @@ def _parse_requirements(lines: Iterable[str]) -> Iterator[_RequirementWithCommen
127128
pip_argument = None
128129

129130

130-
def load_requirements(path_dir: str, file_name: str = "base.txt", unfreeze: str = "all") -> List[str]:
131+
def load_requirements(path_dir: str, file_name: str = "base.txt", unfreeze: str = "all") -> list[str]:
131132
"""Loading requirements from a file.
132133
133134
>>> path_req = os.path.join(_PROJECT_ROOT, "requirements")
@@ -222,7 +223,7 @@ def _load_aggregate_requirements(req_dir: str = "requirements", freeze_requireme
222223
fp.writelines([ln + os.linesep for ln in requires] + [os.linesep])
223224

224225

225-
def _retrieve_files(directory: str, *ext: str) -> List[str]:
226+
def _retrieve_files(directory: str, *ext: str) -> list[str]:
226227
all_files = []
227228
for root, _, files in os.walk(directory):
228229
for fname in files:
@@ -232,7 +233,7 @@ def _retrieve_files(directory: str, *ext: str) -> List[str]:
232233
return all_files
233234

234235

235-
def _replace_imports(lines: List[str], mapping: List[Tuple[str, str]], lightning_by: str = "") -> List[str]:
236+
def _replace_imports(lines: list[str], mapping: list[tuple[str, str]], lightning_by: str = "") -> list[str]:
236237
"""Replace imports of standalone package to lightning.
237238
238239
>>> lns = [
@@ -320,7 +321,7 @@ def copy_replace_imports(
320321
fo.writelines(lines)
321322

322323

323-
def create_mirror_package(source_dir: str, package_mapping: Dict[str, str]) -> None:
324+
def create_mirror_package(source_dir: str, package_mapping: dict[str, str]) -> None:
324325
"""Create a mirror package with adjusted imports."""
325326
# replace imports and copy the code
326327
mapping = package_mapping.copy()
@@ -480,6 +481,25 @@ def convert_version2nightly(ver_file: str = "src/version.info") -> None:
480481
with open(ver_file, "w") as fo:
481482
fo.write(version + os.linesep)
482483

484+
@staticmethod
485+
def generate_docker_tags(
486+
release_version: str,
487+
python_version: str,
488+
torch_version: str,
489+
cuda_version: str,
490+
docker_project: str = "pytorchlightning/pytorch_lightning",
491+
add_latest: bool = False,
492+
) -> None:
493+
"""Generate docker tags for the given versions."""
494+
tags = [f"latest-py{python_version}-torch{torch_version}-cuda{cuda_version}"]
495+
if release_version:
496+
tags += [f"{release_version}-py{python_version}-torch{torch_version}-cuda{cuda_version}"]
497+
if add_latest:
498+
tags += ["latest"]
499+
500+
tags = [f"{docker_project}:{tag}" for tag in tags]
501+
print(",".join(tags))
502+
483503

484504
if __name__ == "__main__":
485505
import jsonargparse

.actions/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
jsonargparse >=4.16.0, <4.28.0
1+
jsonargparse >=4.16.0, <=4.35.0
22
requests
33
packaging

.azure/gpu-benchmarks.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
variables:
4747
DEVICES: $( python -c 'print("$(Agent.Name)".split("_")[-1])' )
4848
container:
49-
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.4-cuda12.1.0"
49+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.5-cuda12.1.0"
5050
options: "--gpus=all --shm-size=32g"
5151
strategy:
5252
matrix:
@@ -75,7 +75,9 @@ jobs:
7575
pip list
7676
displayName: "Image info & NVIDIA"
7777
78-
- bash: pip install -e .[dev] --find-links ${TORCH_URL}
78+
- bash: |
79+
pip install -e .[dev] --find-links ${TORCH_URL}
80+
pip install setuptools==75.6.0 jsonargparse==4.35.0
7981
env:
8082
FREEZE_REQUIREMENTS: "1"
8183
displayName: "Install package"
@@ -106,5 +108,6 @@ jobs:
106108
condition: and(succeeded(), eq(variables['PACKAGE_NAME'], 'fabric'))
107109
env:
108110
PL_RUN_CUDA_TESTS: "1"
111+
PL_RUN_STANDALONE_TESTS: "1"
109112
displayName: "Testing: fabric standalone tasks"
110113
timeoutInMinutes: "10"

.azure/gpu-tests-fabric.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ jobs:
5656
options: "--gpus=all --shm-size=2gb -v /var/tmp:/var/tmp"
5757
strategy:
5858
matrix:
59+
"Fabric | oldest":
60+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.10-torch2.1-cuda12.1.1"
61+
PACKAGE_NAME: "fabric"
5962
"Fabric | latest":
60-
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.11-torch2.3-cuda12.1.0"
63+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.6-cuda12.4.1"
6164
PACKAGE_NAME: "fabric"
6265
"Lightning | latest":
63-
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.4-cuda12.1.0"
66+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.6-cuda12.4.1"
6467
PACKAGE_NAME: "lightning"
6568
workspace:
6669
clean: all
@@ -77,9 +80,8 @@ jobs:
7780
displayName: "set env. vars"
7881
- bash: |
7982
echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/test/cu${CUDA_VERSION_MM}"
80-
echo "##vso[task.setvariable variable=TORCHVISION_URL]https://download.pytorch.org/whl/test/cu124/torchvision-0.19.0%2Bcu124-cp${PYTHON_VERSION_MM}-cp${PYTHON_VERSION_MM}-linux_x86_64.whl"
8183
condition: endsWith(variables['Agent.JobName'], 'future')
82-
displayName: "set env. vars 4 future"
84+
displayName: "extend env. vars 4 future"
8385
8486
- bash: |
8587
echo $(DEVICES)
@@ -105,14 +107,17 @@ jobs:
105107
displayName: "Adjust dependencies"
106108
107109
- bash: |
110+
set -e
108111
extra=$(python -c "print({'lightning': 'fabric-'}.get('$(PACKAGE_NAME)', ''))")
109-
pip install -e ".[${extra}dev]" pytest-timeout -U --find-links="${TORCH_URL}" --find-links="${TORCHVISION_URL}"
112+
pip install -e ".[${extra}dev]" pytest-timeout -U --extra-index-url="${TORCH_URL}"
113+
pip install setuptools==75.6.0 jsonargparse==4.35.0
110114
displayName: "Install package & dependencies"
111115
112116
- bash: |
113117
set -e
114118
python requirements/collect_env_details.py
115119
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu == 2, f'GPU: {mgpu}'"
120+
python requirements/pytorch/check-avail-extras.py
116121
python -c "import bitsandbytes"
117122
displayName: "Env details"
118123
@@ -134,15 +139,17 @@ jobs:
134139
condition: and(succeeded(), eq(variables['PACKAGE_NAME'], 'fabric'))
135140
displayName: "Adjust tests & examples"
136141
137-
- bash: python -m coverage run --source ${COVERAGE_SOURCE} -m pytest . -v --durations=50
138-
workingDirectory: tests/tests_fabric/
142+
- bash: python -m coverage run --source ${COVERAGE_SOURCE} -m pytest tests_fabric/ -v --durations=50
143+
workingDirectory: tests/
139144
displayName: "Testing: fabric standard"
140145
timeoutInMinutes: "10"
141146

142-
- bash: bash ../run_standalone_tests.sh "."
143-
workingDirectory: tests/tests_fabric/
147+
- bash: |
148+
wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/run_standalone_tests.sh
149+
bash ./run_standalone_tests.sh "tests_fabric"
150+
workingDirectory: tests/
144151
env:
145-
PL_STANDALONE_TESTS_SOURCE: $(COVERAGE_SOURCE)
152+
PL_RUN_STANDALONE_TESTS: "1"
146153
displayName: "Testing: fabric standalone"
147154
timeoutInMinutes: "10"
148155
@@ -157,7 +164,7 @@ jobs:
157164
./codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) \
158165
--flags=gpu,pytest,${COVERAGE_SOURCE} --name="GPU-coverage" --env=linux,azure
159166
ls -l
160-
workingDirectory: tests/tests_fabric/
167+
workingDirectory: tests/
161168
displayName: "Statistics"
162169
163170
- script: |

.azure/gpu-tests-pytorch.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,14 @@ jobs:
4949
cancelTimeoutInMinutes: "2"
5050
strategy:
5151
matrix:
52+
"PyTorch | oldest":
53+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.10-torch2.1-cuda12.1.1"
54+
PACKAGE_NAME: "pytorch"
5255
"PyTorch | latest":
53-
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.11-torch2.3-cuda12.1.0"
56+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.6-cuda12.4.1"
5457
PACKAGE_NAME: "pytorch"
5558
"Lightning | latest":
56-
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.4-cuda12.1.0"
59+
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.12-torch2.6-cuda12.4.1"
5760
PACKAGE_NAME: "lightning"
5861
pool: lit-rtx-3090
5962
variables:
@@ -81,9 +84,8 @@ jobs:
8184
displayName: "set env. vars"
8285
- bash: |
8386
echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/test/cu${CUDA_VERSION_MM}"
84-
echo "##vso[task.setvariable variable=TORCHVISION_URL]https://download.pytorch.org/whl/test/cu124/torchvision-0.19.0%2Bcu124-cp${PYTHON_VERSION_MM}-cp${PYTHON_VERSION_MM}-linux_x86_64.whl"
8587
condition: endsWith(variables['Agent.JobName'], 'future')
86-
displayName: "set env. vars 4 future"
88+
displayName: "extend env. vars 4 future"
8789
8890
- bash: |
8991
echo $(DEVICES)
@@ -109,8 +111,10 @@ jobs:
109111
displayName: "Adjust dependencies"
110112
111113
- bash: |
114+
set -e
112115
extra=$(python -c "print({'lightning': 'pytorch-'}.get('$(PACKAGE_NAME)', ''))")
113-
pip install -e ".[${extra}dev]" pytest-timeout -U --find-links="${TORCH_URL}" --find-links="${TORCHVISION_URL}"
116+
pip install -e ".[${extra}dev]" pytest-timeout -U --extra-index-url="${TORCH_URL}"
117+
pip install setuptools==75.6.0 jsonargparse==4.35.0
114118
displayName: "Install package & dependencies"
115119
116120
- bash: pip uninstall -y lightning
@@ -155,16 +159,18 @@ jobs:
155159
ls -l checkpoints/
156160
displayName: "Get legacy checkpoints"
157161
158-
- bash: python -m coverage run --source ${COVERAGE_SOURCE} -m pytest -v --durations=50
159-
workingDirectory: tests/tests_pytorch
162+
- bash: python -m coverage run --source ${COVERAGE_SOURCE} -m pytest tests_pytorch/ -v --durations=50
163+
workingDirectory: tests/
160164
displayName: "Testing: PyTorch standard"
161165
timeoutInMinutes: "35"
162166

163-
- bash: bash ../run_standalone_tests.sh "."
164-
workingDirectory: tests/tests_pytorch
167+
- bash: |
168+
wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/run_standalone_tests.sh
169+
bash ./run_standalone_tests.sh "tests_pytorch"
170+
workingDirectory: tests/
165171
env:
166172
PL_USE_MOCKED_MNIST: "1"
167-
PL_STANDALONE_TESTS_SOURCE: $(COVERAGE_SOURCE)
173+
PL_RUN_STANDALONE_TESTS: "1"
168174
displayName: "Testing: PyTorch standalone tests"
169175
timeoutInMinutes: "35"
170176

.github/CODEOWNERS

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,16 @@
55
# the repo. Unless a later match takes precedence,
66
# @global-owner1 and @global-owner2 will be requested for
77
# review when someone opens a pull request.
8-
* @lantiga @borda @tchaton @awaelchli @justusschock
9-
10-
# CI/CD and configs
11-
/.actions/ @borda @ethanwharris @justusschock
12-
/.github/ @borda @ethanwharris @justusschock
13-
/.azure/ @borda @ethanwharris @justusschock
14-
/dockers/ @borda @ethanwharris @justusschock
15-
*.yml @borda @ethanwharris @justusschock
8+
* @lantiga @borda @tchaton @justusschock @ethanwharris
169

1710
# Docs
18-
/docs/ @lantiga @borda @awaelchli
19-
/docs/*/conf.py @borda @awaelchli
2011
/.github/*.md @williamfalcon @lantiga @borda
21-
/.github/ISSUE_TEMPLATE/ @borda @tchaton @awaelchli
22-
/docs/source-fabric/conf.py @borda @awaelchli
23-
/docs/source-fabric/index.rst @awaelchli @lantiga
24-
/docs/source-pytorch/conf.py @borda @awaelchli
12+
/docs/source-fabric/index.rst @williamfalcon @lantiga
2513
/docs/source-pytorch/index.rst @williamfalcon @lantiga
2614
/docs/source-pytorch/levels @williamfalcon @lantiga
2715

28-
# PyTorch Lightning
29-
/src/lightning/pytorch @lantiga @borda @tchaton @awaelchli @justusschock
30-
31-
# Lightning Data
32-
/src/lightning/data/ @tchaton @lantiga
33-
34-
# Lightning Fabric
35-
/src/lightning/fabric @lantiga @borda @tchaton @awaelchli @justusschock
36-
3716
/.github/CODEOWNERS @williamfalcon
3817
/SECURITY.md @williamfalcon @lantiga
3918
/README.md @williamfalcon @lantiga
40-
/setup.py @williamfalcon @borda
41-
/src/pytorch_lightning/__about__.py @williamfalcon @borda
42-
/src/lightning_fabric/__about__.py @williamfalcon @borda @awaelchli
43-
/src/*/__setup__.py @borda @justusschock
19+
/src/pytorch_lightning/__about__.py @williamfalcon @lantiga @borda
20+
/src/lightning_fabric/__about__.py @williamfalcon @lantiga @borda

.github/CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ We welcome any useful contribution! For your convenience here's a recommended wo
182182
1. Use tags in PR name for the following cases:
183183

184184
- **\[blocked by #<number>\]** if your work is dependent on other PRs.
185-
- **\[wip\]** when you start to re-edit your work, mark it so no one will accidentally merge it in meantime.
185+
- **[wip]** when you start to re-edit your work, mark it so no one will accidentally merge it in meantime.
186186

187187
### Question & Answer
188188

189189
#### How can I help/contribute?
190190

191191
All types of contributions are welcome - reporting bugs, fixing documentation, adding test cases, solving issues, and preparing bug fixes.
192-
To get started with code contributions, look for issues marked with the label [good first issue](https://github.com/Lightning-AI/lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) or chose something close to your domain with the label [help wanted](https://github.com/Lightning-AI/lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). Before coding, make sure that the issue description is clear and comment on the issue so that we can assign it to you (or simply self-assign if you can).
192+
To get started with code contributions, look for issues marked with the label [good first issue](https://github.com/Lightning-AI/pytorch-lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) or chose something close to your domain with the label [help wanted](https://github.com/Lightning-AI/pytorch-lightning/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). Before coding, make sure that the issue description is clear and comment on the issue so that we can assign it to you (or simply self-assign if you can).
193193

194194
#### Is there a recommendation for branch names?
195195

.github/ISSUE_TEMPLATE/1_bug_report.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ body:
3737
- "v2.2"
3838
- "v2.3"
3939
- "v2.4"
40+
- "v2.5"
4041
- "master"
4142
validations:
4243
required: true
@@ -91,8 +92,8 @@ body:
9192
<summary>Current environment</summary>
9293
9394
```
94-
#- PyTorch Lightning Version (e.g., 2.4.0):
95-
#- PyTorch Version (e.g., 2.4):
95+
#- PyTorch Lightning Version (e.g., 2.5.0):
96+
#- PyTorch Version (e.g., 2.5):
9697
#- Python version (e.g., 3.12):
9798
#- OS (e.g., Linux):
9899
#- CUDA/cuDNN version:

.github/actions/pip-wheels/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ runs:
4646
run: |
4747
# cat requirements.dump
4848
pip wheel -r requirements.dump --prefer-binary \
49-
--wheel-dir=.wheels \
50-
-f ${{ inputs.torch-url }} -f ${{ inputs.wheel-dir }}
49+
--wheel-dir=".wheels" \
50+
--extra-index-url=${{ inputs.torch-url }} -f ${{ inputs.wheel-dir }}
5151
ls -lh .wheels/
5252
shell: bash
5353

.github/advanced-issue-labeler.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ policy:
1616
keys: ["v2_3", "v2.3", "2.3.x"]
1717
- name: "ver: 2.4.x"
1818
keys: ["v2_4", "v2.4", "2.4.x"]
19-
- name: "ver: 2.4.x"
19+
- name: "ver: 2.5.x"
20+
keys: ["v2_5", "v2.5", "2.5.x"]
21+
- name: "ver: 2.5.x"
2022
keys: ["master"]

0 commit comments

Comments
 (0)