Skip to content

Commit abba0d0

Browse files
authored
Merge branch 'master' into dependabot-pip-requirements-torch-2.9.0
2 parents 986f3db + a7cb33a commit abba0d0

File tree

71 files changed

+149
-1755
lines changed

Some content is hidden

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

71 files changed

+149
-1755
lines changed

.azure/gpu-tests-fabric.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
cuda_ver=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
7777
echo "##vso[task.setvariable variable=CUDA_VERSION_MM]$cuda_ver"
7878
echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/cu${cuda_ver}/torch_stable.html"
79-
scope=$(python -c 'n = "$(PACKAGE_NAME)" ; print(dict(fabric="lightning_fabric").get(n, n))')
79+
scope=$(python -c 'n = "${PACKAGE_NAME}" ; print(dict(fabric="lightning_fabric").get(n, n))')
8080
echo "##vso[task.setvariable variable=COVERAGE_SOURCE]$scope"
8181
displayName: "set env. vars"
8282
- bash: |
@@ -140,7 +140,7 @@ jobs:
140140
141141
- bash: |
142142
set -e
143-
extra=$(python -c "print({'lightning': 'fabric-'}.get('$(PACKAGE_NAME)', ''))")
143+
extra=$(python -c "print({'lightning': 'fabric-'}.get('${PACKAGE_NAME}', ''))")
144144
pip install -e ".[${extra}dev]" -U --upgrade-strategy=eager --extra-index-url="${TORCH_URL}"
145145
displayName: "Install package & dependencies"
146146

.azure/gpu-tests-pytorch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
cuda_ver=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
7676
echo "##vso[task.setvariable variable=CUDA_VERSION_MM]$cuda_ver"
7777
echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/cu${cuda_ver}/torch_stable.html"
78-
scope=$(python -c 'n = "$(PACKAGE_NAME)" ; print(dict(pytorch="pytorch_lightning").get(n, n))')
78+
scope=$(python -c 'n = "${PACKAGE_NAME}" ; print(dict(pytorch="pytorch_lightning").get(n, n))')
7979
echo "##vso[task.setvariable variable=COVERAGE_SOURCE]$scope"
8080
displayName: "set env. vars"
8181
- bash: |
@@ -139,7 +139,7 @@ jobs:
139139
140140
- bash: |
141141
set -e
142-
extra=$(python -c "print({'lightning': 'pytorch-'}.get('$(PACKAGE_NAME)', ''))")
142+
extra=$(python -c "print({'lightning': 'pytorch-'}.get('${PACKAGE_NAME}', ''))")
143143
pip install -e ".[${extra}dev]" -U --upgrade-strategy=eager --extra-index-url="${TORCH_URL}"
144144
displayName: "Install package & dependencies"
145145

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ jobs:
133133
run: |
134134
uv pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
135135
--upgrade \
136-
-r requirements/_integrations/accelerators.txt \
137136
--find-links="${TORCH_URL}" \
138137
--find-links="https://download.pytorch.org/whl/torch-tensorrt"
139138
uv pip list

.lightning/workflows/fabric.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ run: |
8585
CUDA_VERSION_M_M="${CUDA_VERSION%.*}" # "12.6"
8686
CUDA_VERSION_MM="${CUDA_VERSION_M_M//./}" # "126"
8787
export UV_TORCH_BACKEND=cu${CUDA_VERSION_MM}
88-
COVERAGE_SOURCE=$(python -c 'n = "$(PACKAGE_NAME)" ; print(dict(fabric="lightning_fabric").get(n, n))')
88+
COVERAGE_SOURCE=$(python -c 'n = "${PACKAGE_NAME}" ; print(dict(fabric="lightning_fabric").get(n, n))')
8989
echo "collecting coverage for: ${COVERAGE_SOURCE}"
9090
9191
uv pip install fire wget packaging "lightning-utilities[cli]"
@@ -120,7 +120,7 @@ run: |
120120
fi
121121
122122
echo "Install package with [${PACKAGE_NAME}] extras"
123-
extra=$(python -c "print({'lightning': 'fabric-'}.get('$(PACKAGE_NAME)', ''))")
123+
extra=$(python -c "print({'lightning': 'fabric-'}.get('${PACKAGE_NAME}', ''))")
124124
uv pip install ".[${extra}dev]" --upgrade
125125
126126
python requirements/collect_env_details.py

.lightning/workflows/pytorch.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ env:
2727
DEBIAN_FRONTEND: "noninteractive"
2828
CUDA_TOOLKIT_ROOT_DIR: "/usr/local/cuda"
2929
MKL_THREADING_LAYER: "GNU"
30-
CUDA_LAUNCH_BLOCKING: "1"
3130
NCCL_DEBUG: "INFO"
3231
TORCHDYNAMO_VERBOSE: "1"
3332
FREEZE_REQUIREMENTS: "1"
@@ -50,7 +49,8 @@ run: |
5049
openmpi-bin \
5150
ninja-build \
5251
libnccl2 \
53-
libnccl-dev
52+
libnccl-dev \
53+
unzip
5454
5555
echo "Install Python ${python_version} and UV"
5656
apt-get install -y python${python_version} python${python_version}-venv python${python_version}-dev
@@ -85,7 +85,7 @@ run: |
8585
CUDA_VERSION_M_M="${CUDA_VERSION%.*}" # "12.6"
8686
CUDA_VERSION_MM="${CUDA_VERSION_M_M//./}" # "126"
8787
export UV_TORCH_BACKEND=cu${CUDA_VERSION_MM}
88-
COVERAGE_SOURCE=$(python -c 'n = "$(PACKAGE_NAME)" ; print(dict(fabric="pytorch_lightning").get(n, n))')
88+
COVERAGE_SOURCE=$(python -c 'n = "${PACKAGE_NAME}" ; print(dict(fabric="pytorch_lightning").get(n, n))')
8989
echo "collecting coverage for: ${COVERAGE_SOURCE}"
9090
9191
uv pip install -q fire wget packaging "lightning-utilities[cli]"
@@ -120,7 +120,7 @@ run: |
120120
fi
121121
122122
echo "Install package"
123-
extra=$(python -c "print({'lightning': 'pytorch-'}.get('$(PACKAGE_NAME)', ''))")
123+
extra=$(python -c "print({'lightning': 'pytorch-'}.get('${PACKAGE_NAME}', ''))")
124124
uv pip install -e ".[${extra}dev]" --upgrade
125125
126126
echo "Ensure only a single package is installed"

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ repos:
2727
hooks:
2828
- id: end-of-file-fixer
2929
- id: trailing-whitespace
30-
# keep formatting in README flexible
31-
exclude: README.md
30+
exclude: README.md # keep formatting in README flexible
3231
- id: check-json
3332
- id: check-yaml
3433
- id: check-toml

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ Over 340,000 developers use [Lightning Cloud](https://lightning.ai/?utm_source=p
6464
- [Notebooks](https://lightning.ai/notebooks?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme): Persistent GPU workspaces where AI helps you code and analyze.
6565
- [Inference](https://lightning.ai/deploy?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme): Deploy models as inference APIs.
6666

67+
<a id="why-pytorch-lightning"></a>
6768
# Why PyTorch Lightning?
6869

69-
Training models in plain PyTorch is tedious and error-prone - you have to manually handle things like backprop, mixed precision, multi-GPU, and distributed training, often rewriting code for every new project. PyTorch Lightning organizes PyTorch code to automate those complexities so you can focus on your model and data, while keeping full control and scaling from CPU to multi-node without changing your core code. But if you want control of those things, you can still opt into [expert-level control](#lightning-fabric-expert-contro).
70+
Training models in plain PyTorch is tedious and error-prone - you have to manually handle things like backprop, mixed precision, multi-GPU, and distributed training, often rewriting code for every new project. PyTorch Lightning organizes PyTorch code to automate those complexities so you can focus on your model and data, while keeping full control and scaling from CPU to multi-node without changing your core code. But if you want control of those things, you can still opt into [expert-level control](#lightning-fabric-expert-control).
7071

7172
Fun analogy: If PyTorch is Javascript, PyTorch Lightning is ReactJS or NextJS.
7273

@@ -215,7 +216,7 @@ Explore various types of training possible with PyTorch Lightning. Pretrain and
215216

216217
| Task | Description | Run |
217218
|------|--------------|-----|
218-
| [Hello world](#hello-simple-model) | Pretrain - Hello world example | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/pytorch-lightning-hello-world?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
219+
| [Hello world](https://lightning.ai/lightning-ai/studios/pytorch-lightning-hello-world?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme) | Pretrain - Hello world example | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/pytorch-lightning-hello-world?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
219220
| [Image classification](https://lightning.ai/lightning-ai/studios/image-classification-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme) | Finetune - ResNet-34 model to classify images of cars | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/image-classification-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
220221
| [Image segmentation](https://lightning.ai/lightning-ai/studios/image-segmentation-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme) | Finetune - ResNet-50 model to segment images | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/image-segmentation-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |
221222
| [Object detection](https://lightning.ai/lightning-ai/studios/object-detection-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme) | Finetune - Faster R-CNN model to detect objects | <a target="_blank" href="https://lightning.ai/lightning-ai/studios/object-detection-with-pytorch-lightning?utm_source=ptl_readme&utm_medium=referral&utm_campaign=ptl_readme"><img src="https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/app-2/studio-badge.svg" alt="Open In Studio"/></a> |

docs/source-pytorch/common/index.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
Save memory with half-precision <precision>
1717
../advanced/model_parallel
1818
Train on single or multiple GPUs <../accelerators/gpu>
19-
Train on single or multiple HPUs <../integrations/hpu/index>
2019
Train on single or multiple TPUs <../accelerators/tpu>
2120
Train on MPS <../accelerators/mps>
2221
Use a pretrained model <../advanced/pretrained>
@@ -161,13 +160,6 @@ How-to Guides
161160
:col_css: col-md-4
162161
:height: 180
163162

164-
.. displayitem::
165-
:header: Train on single or multiple HPUs
166-
:description: Train models faster with HPU accelerators
167-
:button_link: ../integrations/hpu/index.html
168-
:col_css: col-md-4
169-
:height: 180
170-
171163
.. displayitem::
172164
:header: Train on single or multiple TPUs
173165
:description: TTrain models faster with TPU accelerators

docs/source-pytorch/common/trainer.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ By setting ``workers=True`` in :func:`~lightning.pytorch.seed_everything`, Light
165165
unique seeds across all dataloader workers and processes for :mod:`torch`, :mod:`numpy` and stdlib
166166
:mod:`random` number generators. When turned on, it ensures that e.g. data augmentations are not repeated across workers.
167167

168+
.. note::
169+
170+
If your project depends on NumPy for randomness (e.g. for data
171+
augmentation), it is recommended to use version 2.5.0 or higher.
172+
168173
-------
169174

170175
.. _trainer_flags:

docs/source-pytorch/common_usecases.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ Customize and extend Lightning for things like custom hardware or distributed st
126126
:button_link: accelerators/gpu.html
127127
:height: 100
128128

129-
.. displayitem::
130-
:header: Train on single or multiple HPUs
131-
:description: Train models faster with HPUs.
132-
:col_css: col-md-12
133-
:button_link: integrations/hpu/index.html
134-
:height: 100
135-
136129
.. displayitem::
137130
:header: Train on single or multiple TPUs
138131
:description: Train models faster with TPUs.

0 commit comments

Comments
 (0)