Skip to content

Commit 4ee54f2

Browse files
mattbuotclaude
andauthored
ci: Test Python 3.15 with torch nightly (#788)
- Related to #779 * Add a Python 3.15 + torch nightly config to the tests matrix * In `install-deps`, install torch nightly **before** the other dependencies instead of upgrading to it afterwards. Otherwise, the first install fails on Python 3.15 because no stable torch wheel matches. The existing torch-nightly config should end up with the same packages as before. * Rename `tests/profiling` to `tests/profiler` (and `PROFILING_RESULTS_DIR` to `PROFILER_RESULTS_DIR`). (Python 3.15 adds a stdlib `profiling` package) ------ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e7c27fe commit 4ee54f2

9 files changed

Lines changed: 21 additions & 10 deletions

File tree

‎.github/actions/install-deps/action.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ runs:
2424
shell: bash
2525
run: uv venv
2626

27+
# Installed before the other dependencies, so that it also works on Python versions for which
28+
# no stable torch wheel exists yet.
29+
- name: Install torch nightly
30+
if: ${{ inputs.torch_channel == 'nightly' }}
31+
shell: bash
32+
run: uv pip install --pre torch torchvision -P torch -P torchvision --extra-index-url https://download.pytorch.org/whl/nightly/cpu
33+
2734
- name: Install dependencies (options=[${{ inputs.options }}], groups=[${{ inputs.groups }}])
2835
shell: bash
2936
run: |
@@ -50,9 +57,8 @@ runs:
5057
echo $cmd
5158
eval $cmd
5259
53-
- name: Upgrade to torch nightly
60+
- name: Print torch nightly version
5461
if: ${{ inputs.torch_channel == 'nightly' }}
5562
shell: bash
5663
run: |
57-
uv pip install --pre torch torchvision -P torch -P torchvision --extra-index-url https://download.pytorch.org/whl/nightly/cpu
5864
uv run python -c "import torch, torchvision; print('torch:', torch.__version__, '| torchvision:', torchvision.__version__)"

‎.github/workflows/checks.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ jobs:
4545
extra_groups: 'lower_bounds'
4646
# Latest: torch nightly build.
4747
- torch_channel: 'nightly'
48+
# Upcoming Python version, not yet supported by stable torch. cvxpy is excluded because one
49+
# of its dependencies (sparsediffpy) has no wheel yet and can't be built without BLAS.
50+
- python-version: '3.15'
51+
torch_channel: 'nightly'
52+
options: 'quadprog_projector fairgrad'
4853

4954
steps:
5055
- name: Checkout repository

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ worktrees/
66
CLAUDE.md
77
.claude/
88

9-
# Profiling results
10-
tests/profiling/results/
9+
# Profiler results
10+
tests/profiler/results/
1111

1212
# Trajectories results
1313
tests/trajectories/results/

‎tests/paths.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
TORCHJD_DIR = Path(__file__).parent.parent
44
TESTS_DIR = Path(__file__).parent
55
PLOTS_RESULTS_DIR = TESTS_DIR / "plots" / "results"
6-
PROFILING_RESULTS_DIR = TESTS_DIR / "profiling" / "results"
6+
PROFILER_RESULTS_DIR = TESTS_DIR / "profiler" / "results"
77
TRAJECTORIES_RESULTS_DIR = TESTS_DIR / "trajectories" / "results"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
matplotlib.use("Agg") # Use non-GUI backend to avoid tkinter dependency
1414
import matplotlib.pyplot as plt
1515
import numpy as np
16-
from paths import PROFILING_RESULTS_DIR
16+
from paths import PROFILER_RESULTS_DIR
1717

1818

1919
@dataclass
@@ -63,7 +63,7 @@ def plot_memory_timelines(experiment: str, folders: list[str]) -> None:
6363
cpu_timelines = []
6464
cuda_timelines = []
6565
for folder in folders:
66-
path = PROFILING_RESULTS_DIR / folder / f"{experiment}.json"
66+
path = PROFILER_RESULTS_DIR / folder / f"{experiment}.json"
6767
cpu_timeline, cuda_timeline = extract_memory_timelines(path)
6868
cpu_timelines.append(cpu_timeline)
6969
cuda_timelines.append(cuda_timeline)
@@ -104,7 +104,7 @@ def plot_memory_timelines(experiment: str, folders: list[str]) -> None:
104104

105105
fig.tight_layout()
106106

107-
output_dir = Path(PROFILING_RESULTS_DIR / "memory_timelines")
107+
output_dir = Path(PROFILER_RESULTS_DIR / "memory_timelines")
108108
output_dir.mkdir(parents=True, exist_ok=True)
109109
output_path = output_dir / f"{experiment}.png"
110110
print(f"\nSaving plot to: {output_path}")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424
from utils.tensors import make_inputs_and_targets
2525

26-
from tests.paths import PROFILING_RESULTS_DIR
26+
from tests.paths import PROFILER_RESULTS_DIR
2727
from torchjd.aggregation import UPGrad, UPGradWeighting
2828
from torchjd.autogram import Engine
2929

@@ -98,7 +98,7 @@ def _save_and_print_trace(
9898
batch_size: int,
9999
) -> None:
100100
filename = f"{factory}-bs{batch_size}-{DEVICE.type}.json"
101-
output_dir = PROFILING_RESULTS_DIR / method_name
101+
output_dir = PROFILER_RESULTS_DIR / method_name
102102
output_dir.mkdir(parents=True, exist_ok=True)
103103
trace_path = output_dir / filename
104104

File renamed without changes.

0 commit comments

Comments
 (0)