Skip to content

[wip] ci: drop PyTorch 2.0-2.5 and raise minimum to 2.6 - #3449

Open
bhimrazy wants to merge 4 commits into
Lightning-AI:masterfrom
bhimrazy:ci/drop-torch-2.0-2.5
Open

[wip] ci: drop PyTorch 2.0-2.5 and raise minimum to 2.6#3449
bhimrazy wants to merge 4 commits into
Lightning-AI:masterfrom
bhimrazy:ci/drop-torch-2.0-2.5

Conversation

@bhimrazy

@bhimrazy bhimrazy commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Drops the end-of-life PyTorch minors and raises the floor to 2.6, keeping the latest five supported minors (2.6–2.10). Mirrors Lightning-AI/pytorch-lightning#21851.

  • CPU matrix: drop the 2.0–2.5 rows, retarget oldest/macOS/Windows to 2.6.0 — 23 → 17 jobs
  • Docker: drop the 2.0.1–2.5.1 CUDA images — 14 → 8 builds
  • GPU lanes: oldest image moves to torch 2.6
  • Requirements: torch >=2.6.0, torchaudio >=2.6.0, torchvision >=0.21.0, pytorch-lightning >=2.5.1 (first release CI-tested against torch 2.6)

The GPU lanes hardcoded TORCH_VER == "2.0" to gate the oldest requirements, which silently goes stale when the floor moves on the CPU side. Now derived from requirements/base.txt, with a fail-fast check if an image sits below the declared floor.

Note

Stacked on #3448 — that fix is required for the GPU oldest lane to pass on torch 2.6. Review the top commit only; rebasing once #3448 lands.

Follow-ups: docs/support policy, then removing the dead _TORCH_GREATER_EQUAL_2_1..2_5 paths.

…t device

`Metric.__init__` gated the use of `torch.get_default_device()` on torch >= 2.3.
However, until torch 2.8 that function only reflected `set_default_device()` and
ignored an active `with torch.device(...)` context manager, so metrics created
inside such a block were assigned the CPU instead of the context device.

torch 2.8 (pytorch/pytorch v2.8.0) added the `DeviceContext` lookup to
`get_default_device`, so gate on 2.8 and keep the `torch.empty(0).device` probe
for older versions, which does respect the context manager.

Verified on torch 2.6.0: inside `with torch.device("meta")`,
`get_default_device()` returns cpu while `torch.empty(0).device` returns meta.

Adds a CPU-runnable regression test using the meta device; the existing coverage
for this path was GPU-only.
Drops the end-of-life PyTorch minors and raises the floor to 2.6, keeping the
latest five supported minors (2.6-2.10), matching what Lightning did in #21851.

- CPU matrix: drop the 2.0-2.5 rows and retarget the oldest/macOS/Windows
  entries to 2.6.0 (23 -> 17 jobs).
- Docker: drop the 2.0.1-2.5.1 CUDA images (14 -> 8 builds); 2.6.0/cu12.4.1 is
  the new oldest. Dockerfile ARG defaults follow it.
- GPU lanes: move the oldest image to torch 2.6 (cu12.4.1 for unittests,
  pytorch/pytorch:2.6.0-cuda12.4 for integrations).
- Requirements: torch >=2.6.0, torchaudio >=2.6.0, torchvision >=0.21.0.
- pytorch-lightning floor 1.9.0 -> 2.5.1, the first release CI-tested against
  torch 2.6.

The GPU lanes previously hardcoded `TORCH_VER == "2.0"` to decide whether to
apply the oldest requirements. That silently goes stale whenever the floor moves
on the CPU side, so derive it from requirements/base.txt instead and fail fast
if an image is below the declared floor.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36%. Comparing base (d184220) to head (d10b959).
⚠️ Report is 10 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #3449   +/-   ##
======================================
- Coverage      37%     36%   -0%     
======================================
  Files         349     349           
  Lines       19901   19910    +9     
======================================
- Hits         7264    7263    -1     
- Misses      12637   12647   +10     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants