From 9e30c659938d0829faea845be30b822b188efe45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Tue, 3 Feb 2026 00:28:44 +0100 Subject: [PATCH 01/10] Increase permutation invariance tolerance for UPGrad --- tests/unit/aggregation/test_upgrad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/aggregation/test_upgrad.py b/tests/unit/aggregation/test_upgrad.py index 437de922..9fc480d2 100644 --- a/tests/unit/aggregation/test_upgrad.py +++ b/tests/unit/aggregation/test_upgrad.py @@ -33,7 +33,7 @@ def test_non_conflicting(aggregator: UPGrad, matrix: Tensor): @mark.parametrize(["aggregator", "matrix"], typical_pairs) def test_permutation_invariant(aggregator: UPGrad, matrix: Tensor): - assert_permutation_invariant(aggregator, matrix, n_runs=5, atol=4e-07, rtol=4e-07) + assert_permutation_invariant(aggregator, matrix, n_runs=5, atol=5e-07, rtol=5e-07) @mark.parametrize(["aggregator", "matrix"], typical_pairs) From e3cd9372b22f051318c4f4ee0de4e39ded6a252c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Tue, 3 Feb 2026 00:34:56 +0100 Subject: [PATCH 02/10] Stop using nn.Buffer in tests (did not exist in torch 2.4.0) --- tests/utils/architectures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/utils/architectures.py b/tests/utils/architectures.py index a74c7de8..2db3698f 100644 --- a/tests/utils/architectures.py +++ b/tests/utils/architectures.py @@ -594,7 +594,7 @@ class WithBuffered(ShapedModule): class _Buffered(nn.Module): def __init__(self): super().__init__() - self.buffer = nn.Buffer(torch.tensor(1.5)) + self.register_buffer("buffer", torch.tensor(1.5)) def forward(self, input: Tensor) -> Tensor: return input * self.buffer @@ -633,7 +633,7 @@ class WithSideEffect(ShapedModule): def __init__(self): super().__init__() self.matrix = nn.Parameter(torch.randn(9, 10)) - self.buffer = nn.Buffer(torch.zeros((9,))) + self.register_buffer("buffer", torch.zeros((9,))) def forward(self, input: Tensor) -> Tensor: self.buffer = self.buffer + 1.0 From 6a8a1dc461e18fa8d2b73b6db65614345917253c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Tue, 3 Feb 2026 00:57:04 +0100 Subject: [PATCH 03/10] Add testing of dependency lower-bounds - This also adjusts the lower bounds --- .github/workflows/checks.yml | 3 +++ pyproject.toml | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9fdd6fa4..77a757b7 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -32,6 +32,9 @@ jobs: - dtype: float64 # Installation options variations - options: 'none' + # Lower-bounds of all dependencies and Python version. + - python-version: '3.10.0' + options: 'ci_dependency_lower_bounds' steps: - name: Checkout repository diff --git a/pyproject.toml b/pyproject.toml index c91e8ed5..40643547 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,9 +13,9 @@ authors = [ ] requires-python = ">=3.10" dependencies = [ - "torch>=2.0.0", + "torch>=2.4.0", # Problems before 2.4.0, especially with autogram. "quadprog>=0.1.9, != 0.1.10", # Doesn't work before 0.1.9, 0.1.10 is yanked - "numpy>=1.21.0", # Does not work before 1.21 + "numpy>=1.23.0", # Does not work before 1.21. No python 3.10 wheel before 1.21.2. matplotlib (required for lightning) requires numpy >= 1.23.0. "qpsolvers>=1.0.1", # Does not work before 1.0.1 ] classifiers = [ @@ -83,7 +83,7 @@ test = [ "pytest>=7.3", # Before version 7.3, not all tests are run "pytest-cov>=6.0.0", # Recent version to avoid problems, could be relaxed "lightning>=2.0.9", # No OptimizerLRScheduler public type before 2.0.9 - "torchvision>=0.22.1" # Recent version to avoid problems, could be relaxed + "torchvision>=0.19.0" # Recent version to avoid problems, could be relaxed ] plot = [ @@ -106,6 +106,15 @@ full = [ "ecos>=2.0.14", # Does not work before 2.0.14 ] +# Optional dependencies allowing to easily pin version of the core dependencies to the lower bound. +# This is not intended to be installed by users: only the CI should every install this. +ci_dependency_lower_bounds = [ + "torch==2.4.0", + "numpy==1.23.0", + "quadprog==0.1.9", + "qpsolvers==1.0.1", +] + [tool.pytest.ini_options] xfail_strict = true From 93e5725d9bfc27c906effa79bcbd4ebbaaf9a1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Tue, 3 Feb 2026 01:04:03 +0100 Subject: [PATCH 04/10] Add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 552e5a59..8693381b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,10 @@ changelog does not include internal changes that do not affect the user. of `autojac`. - Removed an unnecessary internal cloning of gradient. This should slightly improve the memory efficiency of `autojac`. +- Increased the lower bounds of the torch (from 2.0.0 to 2.4.0) and numpy (from 1.21.0 + to 1.23.0) dependencies to reflect what really works with torchjd. We now also run torchjd's tests + with the dependency lower-bounds specified in `pyproject.toml`, so we should now always accurately + reflect the actual lower-bounds. ## [0.8.1] - 2026-01-07 From 5ad6c652b3ce72774e5e3d3b8d01914fa78a2669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= <31951177+ValerianRey@users.noreply.github.com> Date: Tue, 3 Feb 2026 01:14:02 +0100 Subject: [PATCH 05/10] typo --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40643547..821d92e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,7 @@ full = [ ] # Optional dependencies allowing to easily pin version of the core dependencies to the lower bound. -# This is not intended to be installed by users: only the CI should every install this. +# This is not intended to be installed by users: only the CI should ever install this. ci_dependency_lower_bounds = [ "torch==2.4.0", "numpy==1.23.0", From 137e937d63de0b3cb42cf4172b19bda1b28fa517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Tue, 3 Feb 2026 13:50:00 +0100 Subject: [PATCH 06/10] Use dependency group instead of optional deps for lower bounds --- .github/workflows/checks.yml | 6 +++--- pyproject.toml | 16 +++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2fafc1cb..a5a3e276 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,7 +13,7 @@ jobs: tests: # Default config: py3.14, ubuntu-latest, float32, full options. # The idea is to make each of those params vary one by one, to limit the number of tests to run. - name: Tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}) + name: Tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }}${{ matrix.extra_groups && format(', {0}', matrix.extra_groups) || '' }}) runs-on: ${{ matrix.os || 'ubuntu-latest' }} strategy: fail-fast: false @@ -34,7 +34,7 @@ jobs: - options: 'none' # Lower-bounds of all dependencies and Python version. - python-version: '3.10.0' - options: 'ci_dependency_lower_bounds' + extra_groups: 'lower_bounds' steps: - name: Checkout repository @@ -48,7 +48,7 @@ jobs: - uses: ./.github/actions/install-deps with: options: ${{ matrix.options || 'full' }} - groups: test + groups: test ${{ matrix.extra_groups }} - name: Run tests run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml diff --git a/pyproject.toml b/pyproject.toml index 42c9ccd6..ea3a5730 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,13 @@ plot = [ "kaleido==0.2.1", # Only works with locked version "matplotlib>=3.10.0", # Recent version to avoid problems, could be relaxed ] +# Dependency group allowing to easily resolve version of the core dependencies to the lower bound. +lower_bounds = [ + "torch==2.4.0", + "numpy==1.23.0", + "quadprog==0.1.9", + "qpsolvers==1.0.1", +] [project.optional-dependencies] nash_mtl = [ @@ -106,15 +113,6 @@ full = [ "ecos>=2.0.14", # Does not work before 2.0.14 ] -# Optional dependencies allowing to easily pin version of the core dependencies to the lower bound. -# This is not intended to be installed by users: only the CI should ever install this. -ci_dependency_lower_bounds = [ - "torch==2.4.0", - "numpy==1.23.0", - "quadprog==0.1.9", - "qpsolvers==1.0.1", -] - [tool.pytest.ini_options] xfail_strict = true From 7536dd5f6ea6070ddea0f51e17de9f060a82d14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Wed, 4 Feb 2026 02:52:29 +0100 Subject: [PATCH 07/10] Reduce numpy lower bound back to 1.21.2 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ea3a5730..a1784bbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ requires-python = ">=3.10" dependencies = [ "torch>=2.4.0", # Problems before 2.4.0, especially with autogram. "quadprog>=0.1.9, != 0.1.10", # Doesn't work before 0.1.9, 0.1.10 is yanked - "numpy>=1.23.0", # Does not work before 1.21. No python 3.10 wheel before 1.21.2. matplotlib (required for lightning) requires numpy >= 1.23.0. + "numpy>=1.21.2", # Does not work before 1.21. No python 3.10 wheel before 1.21.2. "qpsolvers>=1.0.1", # Does not work before 1.0.1 ] classifiers = [ @@ -95,7 +95,7 @@ plot = [ # Dependency group allowing to easily resolve version of the core dependencies to the lower bound. lower_bounds = [ "torch==2.4.0", - "numpy==1.23.0", + "numpy==1.21.2", "quadprog==0.1.9", "qpsolvers==1.0.1", ] From 9d7499668beeace78178d741d21c572957edfbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Wed, 4 Feb 2026 02:56:42 +0100 Subject: [PATCH 08/10] Fixup --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8693381b..f42b4235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ changelog does not include internal changes that do not affect the user. - Removed an unnecessary internal cloning of gradient. This should slightly improve the memory efficiency of `autojac`. - Increased the lower bounds of the torch (from 2.0.0 to 2.4.0) and numpy (from 1.21.0 - to 1.23.0) dependencies to reflect what really works with torchjd. We now also run torchjd's tests + to 1.21.2) dependencies to reflect what really works with torchjd. We now also run torchjd's tests with the dependency lower-bounds specified in `pyproject.toml`, so we should now always accurately reflect the actual lower-bounds. From 51b3176eec979e792152181f219ca457703dd993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Wed, 4 Feb 2026 03:05:08 +0100 Subject: [PATCH 09/10] Relax torch lower bound to 2.3.0 (it actually works but in 2.2.0 autogram does not because tree_map didn't have a param is_leaf yet) --- CHANGELOG.md | 2 +- pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f42b4235..66b4418b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ changelog does not include internal changes that do not affect the user. of `autojac`. - Removed an unnecessary internal cloning of gradient. This should slightly improve the memory efficiency of `autojac`. -- Increased the lower bounds of the torch (from 2.0.0 to 2.4.0) and numpy (from 1.21.0 +- Increased the lower bounds of the torch (from 2.0.0 to 2.3.0) and numpy (from 1.21.0 to 1.21.2) dependencies to reflect what really works with torchjd. We now also run torchjd's tests with the dependency lower-bounds specified in `pyproject.toml`, so we should now always accurately reflect the actual lower-bounds. diff --git a/pyproject.toml b/pyproject.toml index a1784bbb..7f879851 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ ] requires-python = ">=3.10" dependencies = [ - "torch>=2.4.0", # Problems before 2.4.0, especially with autogram. + "torch>=2.3.0", # Problems before 2.4.0, especially with autogram. "quadprog>=0.1.9, != 0.1.10", # Doesn't work before 0.1.9, 0.1.10 is yanked "numpy>=1.21.2", # Does not work before 1.21. No python 3.10 wheel before 1.21.2. "qpsolvers>=1.0.1", # Does not work before 1.0.1 @@ -83,7 +83,7 @@ test = [ "pytest>=7.3", # Before version 7.3, not all tests are run "pytest-cov>=6.0.0", # Recent version to avoid problems, could be relaxed "lightning>=2.0.9", # No OptimizerLRScheduler public type before 2.0.9 - "torchvision>=0.19.0" # Recent version to avoid problems, could be relaxed + "torchvision>=0.18.0" ] plot = [ @@ -94,7 +94,7 @@ plot = [ ] # Dependency group allowing to easily resolve version of the core dependencies to the lower bound. lower_bounds = [ - "torch==2.4.0", + "torch==2.3.0", "numpy==1.21.2", "quadprog==0.1.9", "qpsolvers==1.0.1", From 096cd2572ca10c5eea950de33088e939ad0d57b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Wed, 4 Feb 2026 03:09:43 +0100 Subject: [PATCH 10/10] Fix newly introduced type error --- tests/utils/architectures.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/utils/architectures.py b/tests/utils/architectures.py index c79d45df..2d7f95da 100644 --- a/tests/utils/architectures.py +++ b/tests/utils/architectures.py @@ -595,6 +595,8 @@ class WithBuffered(ShapedModule): OUTPUT_SHAPES = (10,) class _Buffered(nn.Module): + buffer: Tensor + def __init__(self): super().__init__() self.register_buffer("buffer", torch.tensor(1.5))