Skip to content

Commit ee7c4bb

Browse files
committed
Merge branch 'master' into feature/9580-rich-defaults
2 parents a4910f8 + ce038e8 commit ee7c4bb

File tree

18 files changed

+179
-45
lines changed

18 files changed

+179
-45
lines changed

.github/CONTRIBUTING.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,28 @@ ______________________________________________________________________
113113

114114
To set up a local development environment, we recommend using `uv`, which can be installed following their [instructions](https://docs.astral.sh/uv/getting-started/installation/).
115115

116-
Once `uv` has been installed, begin by cloning the repository:
116+
Once `uv` has been installed, begin by cloning the forked repository:
117117

118118
```bash
119-
git clone https://github.com/Lightning-AI/lightning.git
120-
cd lightning
119+
git clone https://github.com/{YOUR_GITHUB_USERNAME}/pytorch-lightning.git
120+
cd pytorch-lightning
121121
```
122122

123-
Once in root level of the repository, create a new virtual environment and install the project dependencies.
123+
> If you're using [Lightning Studio](https://lightning.ai) or already have your `uv venv` activated, you can quickly set up the project by running:
124+
125+
```bash
126+
make setup
127+
```
128+
129+
This will:
130+
131+
- Install all required dependencies.
132+
- Perform an editable install of the `pytorch-lightning` project.
133+
- Install and configure `pre-commit`.
134+
135+
#### Manual Setup (Optional)
136+
137+
If you prefer more fine-grained control over the dependencies, you can set up the environment manually:
124138

125139
```bash
126140
uv venv

.github/checkgroup.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ subprojects:
135135
- "build-pl (3.11, 2.4, 12.1.1)"
136136
- "build-pl (3.12, 2.5, 12.1.1)"
137137
- "build-pl (3.12, 2.6, 12.4.1)"
138-
- "build-pl (3.12, 2.7, 12.6.3, true)"
138+
- "build-pl (3.12, 2.7, 12.6.3)"
139+
- "build-pl (3.12, 2.8, 12.6.3, true)"
139140

140141
# SECTION: lightning_fabric
141142

.github/workflows/docker-build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ jobs:
4949
- { python_version: "3.11", pytorch_version: "2.4", cuda_version: "12.1.1" }
5050
- { python_version: "3.12", pytorch_version: "2.5", cuda_version: "12.1.1" }
5151
- { python_version: "3.12", pytorch_version: "2.6", cuda_version: "12.4.1" }
52-
- { python_version: "3.12", pytorch_version: "2.7", cuda_version: "12.6.3", latest: "true" }
52+
- { python_version: "3.12", pytorch_version: "2.7", cuda_version: "12.6.3" }
53+
- { python_version: "3.12", pytorch_version: "2.8", cuda_version: "12.6.3", latest: "true" }
5354
steps:
5455
- uses: actions/checkout@v4
5556
with:
@@ -97,7 +98,7 @@ jobs:
9798
# adding dome more images as Thunder mainly using python 3.10,
9899
# and we need to support integrations as for example LitGPT
99100
python_version: ["3.10"]
100-
pytorch_version: ["2.6.0", "2.7.1"]
101+
pytorch_version: ["2.7.1", "2.8.0"]
101102
cuda_version: ["12.6.3"]
102103
include:
103104
# These are the base images for PL release docker images.
@@ -109,6 +110,7 @@ jobs:
109110
- { python_version: "3.12", pytorch_version: "2.5.1", cuda_version: "12.1.1" }
110111
- { python_version: "3.12", pytorch_version: "2.6.0", cuda_version: "12.4.1" }
111112
- { python_version: "3.12", pytorch_version: "2.7.1", cuda_version: "12.6.3" }
113+
- { python_version: "3.12", pytorch_version: "2.8.0", cuda_version: "12.6.3" }
112114
steps:
113115
- uses: actions/checkout@v4
114116
- uses: docker/setup-buildx-action@v3
@@ -129,6 +131,7 @@ jobs:
129131
PYTHON_VERSION=${{ matrix.python_version }}
130132
PYTORCH_VERSION=${{ matrix.pytorch_version }}
131133
CUDA_VERSION=${{ matrix.cuda_version }}
134+
MAKE_FLAGS="-j2"
132135
file: dockers/base-cuda/Dockerfile
133136
push: ${{ env.PUSH_NIGHTLY }}
134137
tags: "pytorchlightning/pytorch_lightning:base-cuda-py${{ matrix.python_version }}-torch${{ env.PT_VERSION }}-cuda${{ matrix.cuda_version }}"
@@ -157,6 +160,8 @@ jobs:
157160
continue-on-error: true
158161
uses: docker/build-push-action@v6
159162
with:
163+
build-args: |
164+
PYTORCH_VERSION="25.04"
160165
file: dockers/nvidia/Dockerfile
161166
push: false
162167
timeout-minutes: 55

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test clean docs
1+
.PHONY: test clean docs setup
22

33
# to imitate SLURM set only single node
44
export SLURM_LOCALID=0
@@ -7,6 +7,23 @@ export SPHINX_MOCK_REQUIREMENTS=1
77
# install only Lightning Trainer packages
88
export PACKAGE_NAME=pytorch
99

10+
setup:
11+
uv pip install -r requirements.txt \
12+
-r requirements/pytorch/base.txt \
13+
-r requirements/pytorch/test.txt \
14+
-r requirements/pytorch/extra.txt \
15+
-r requirements/pytorch/strategies.txt \
16+
-r requirements/fabric/base.txt \
17+
-r requirements/fabric/test.txt \
18+
-r requirements/fabric/strategies.txt \
19+
-r requirements/typing.txt \
20+
-e ".[all]" \
21+
pre-commit
22+
pre-commit install
23+
@echo "-----------------------------"
24+
@echo "✅ Environment setup complete. Ready to Contribute ⚡️!"
25+
26+
1027
clean:
1128
# clean all temp runs
1229
rm -rf $(shell find . -name "mlruns")

dockers/base-cuda/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ ARG CUDA_VERSION=11.7.1
1919
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}
2020

2121
ARG PYTHON_VERSION=3.10
22-
ARG PYTORCH_VERSION=2.1
22+
ARG PYTORCH_VERSION=2.8
2323
ARG MAX_ALLOWED_NCCL=2.22.3
24+
ARG MAKE_FLAGS="-j$(nproc)"
2425

2526
SHELL ["/bin/bash", "-c"]
2627
# https://techoverflow.net/2019/05/18/how-to-fix-configuring-tzdata-interactive-input-when-building-docker-images/
@@ -30,8 +31,7 @@ ENV \
3031
PATH="$PATH:/root/.local/bin" \
3132
CUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda" \
3233
MKL_THREADING_LAYER="GNU" \
33-
# MAKEFLAGS="-j$(nproc)"
34-
MAKEFLAGS="-j2"
34+
MAKEFLAGS=${MAKE_FLAGS}
3535

3636
RUN \
3737
CUDA_VERSION_MM=${CUDA_VERSION%.*} && \

dockers/nvidia/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ARG PYTORCH_VERSION=22.09
15+
ARG PYTORCH_VERSION=24.05
1616

1717
# https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes
1818
FROM nvcr.io/nvidia/pytorch:${PYTORCH_VERSION}-py3

dockers/release/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
ARG PYTHON_VERSION=3.10
16-
ARG PYTORCH_VERSION=2.0
17-
ARG CUDA_VERSION=11.8.0
16+
ARG PYTORCH_VERSION=2.8
17+
ARG CUDA_VERSION=12.6.3
1818

1919
FROM pytorchlightning/pytorch_lightning:base-cuda-py${PYTHON_VERSION}-torch${PYTORCH_VERSION}-cuda${CUDA_VERSION}
2020

docs/source-pytorch/advanced/speed.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ takes a great deal of care to be optimized for this.
464464
Clear Cache
465465
===========
466466

467-
Don't call :func:`torch.cuda.empty_cache` unnecessarily! Every time you call this, ALL your GPUs have to wait to sync.
467+
Don't call ``torch.cuda.empty_cache`` unnecessarily! Every time you call this, ALL your GPUs have to wait to sync.
468468

469469
Transferring Tensors to Device
470470
==============================

src/lightning/fabric/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1616

1717
-
1818

19+
### Changed
20+
21+
- Raise ValueError when seed is `out-of-bounds` or `cannot be cast to int` ([#21029](https://github.com/Lightning-AI/pytorch-lightning/pull/21029))
22+
1923

2024
---
2125

src/lightning/fabric/utilities/seed.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def seed_everything(seed: Optional[int] = None, workers: bool = False, verbose:
2727
Args:
2828
seed: the integer value seed for global random state in Lightning.
2929
If ``None``, it will read the seed from ``PL_GLOBAL_SEED`` env variable. If ``None`` and the
30-
``PL_GLOBAL_SEED`` env variable is not set, then the seed defaults to 0.
30+
``PL_GLOBAL_SEED`` env variable is not set, then the seed defaults to 0. If seed is
31+
not in bounds or cannot be cast to int, a ValueError is raised.
3132
workers: if set to ``True``, will properly configure all dataloaders passed to the
3233
Trainer with a ``worker_init_fn``. If the user already provides such a function
3334
for their dataloaders, setting this argument will have no influence. See also:
@@ -44,14 +45,12 @@ def seed_everything(seed: Optional[int] = None, workers: bool = False, verbose:
4445
try:
4546
seed = int(env_seed)
4647
except ValueError:
47-
seed = 0
48-
rank_zero_warn(f"Invalid seed found: {repr(env_seed)}, seed set to {seed}")
48+
raise ValueError(f"Invalid seed specified via PL_GLOBAL_SEED: {repr(env_seed)}")
4949
elif not isinstance(seed, int):
5050
seed = int(seed)
5151

5252
if not (min_seed_value <= seed <= max_seed_value):
53-
rank_zero_warn(f"{seed} is not in bounds, numpy accepts from {min_seed_value} to {max_seed_value}")
54-
seed = 0
53+
raise ValueError(f"{seed} is not in bounds, numpy accepts from {min_seed_value} to {max_seed_value}")
5554

5655
if verbose:
5756
log.info(rank_prefixed_message(f"Seed set to {seed}", _get_rank()))

0 commit comments

Comments
 (0)