Skip to content

Commit 9ac88b9

Browse files
authored
Merge branch 'main' into switch-to-ruff
2 parents 362f1dc + 970b8e4 commit 9ac88b9

5 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/checks.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
tests:
1414
# Default config: py3.14, ubuntu-latest, float32, full options.
1515
# The idea is to make each of those params vary one by one, to limit the number of tests to run.
16-
name: Tests (py${{ matrix.python-version || '3.14' }}, ${{ matrix.os || 'ubuntu-latest' }}, ${{ matrix.dtype || 'float32' }}, ${{ matrix.options || 'full' }})
16+
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) || '' }})
1717
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
1818
strategy:
1919
fail-fast: false
@@ -32,6 +32,9 @@ jobs:
3232
- dtype: float64
3333
# Installation options variations
3434
- options: 'none'
35+
# Lower-bounds of all dependencies and Python version.
36+
- python-version: '3.10.0'
37+
extra_groups: 'lower_bounds'
3538

3639
steps:
3740
- name: Checkout repository
@@ -45,7 +48,7 @@ jobs:
4548
- uses: ./.github/actions/install-deps
4649
with:
4750
options: ${{ matrix.options || 'full' }}
48-
groups: test
51+
groups: test ${{ matrix.extra_groups }}
4952

5053
- name: Run tests
5154
run: uv run pytest -W error tests/unit tests/doc --cov=src --cov-report=xml

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ changelog does not include internal changes that do not affect the user.
5050
of `autojac`.
5151
- Removed an unnecessary internal cloning of gradient. This should slightly improve the memory
5252
efficiency of `autojac`.
53+
- Increased the lower bounds of the torch (from 2.0.0 to 2.3.0) and numpy (from 1.21.0
54+
to 1.21.2) dependencies to reflect what really works with torchjd. We now also run torchjd's tests
55+
with the dependency lower-bounds specified in `pyproject.toml`, so we should now always accurately
56+
reflect the actual lower-bounds.
5357

5458
## [0.8.1] - 2026-01-07
5559

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ authors = [
1313
]
1414
requires-python = ">=3.10"
1515
dependencies = [
16-
"torch>=2.0.0",
16+
"torch>=2.3.0", # Problems before 2.4.0, especially with autogram.
1717
"quadprog>=0.1.9, != 0.1.10", # Doesn't work before 0.1.9, 0.1.10 is yanked
18-
"numpy>=1.21.0", # Does not work before 1.21
18+
"numpy>=1.21.2", # Does not work before 1.21. No python 3.10 wheel before 1.21.2.
1919
"qpsolvers>=1.0.1", # Does not work before 1.0.1
2020
]
2121
classifiers = [
@@ -85,7 +85,7 @@ test = [
8585
"pytest>=7.3", # Before version 7.3, not all tests are run
8686
"pytest-cov>=6.0.0", # Recent version to avoid problems, could be relaxed
8787
"lightning>=2.0.9", # No OptimizerLRScheduler public type before 2.0.9
88-
"torchvision>=0.22.1" # Recent version to avoid problems, could be relaxed
88+
"torchvision>=0.18.0"
8989
]
9090

9191
plot = [
@@ -94,6 +94,13 @@ plot = [
9494
"kaleido==0.2.1", # Only works with locked version
9595
"matplotlib>=3.10.0", # Recent version to avoid problems, could be relaxed
9696
]
97+
# Dependency group allowing to easily resolve version of the core dependencies to the lower bound.
98+
lower_bounds = [
99+
"torch==2.3.0",
100+
"numpy==1.21.2",
101+
"quadprog==0.1.9",
102+
"qpsolvers==1.0.1",
103+
]
97104

98105
[project.optional-dependencies]
99106
nash_mtl = [

tests/unit/aggregation/test_upgrad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_non_conflicting(aggregator: UPGrad, matrix: Tensor):
3333

3434
@mark.parametrize(["aggregator", "matrix"], typical_pairs)
3535
def test_permutation_invariant(aggregator: UPGrad, matrix: Tensor):
36-
assert_permutation_invariant(aggregator, matrix, n_runs=5, atol=4e-07, rtol=4e-07)
36+
assert_permutation_invariant(aggregator, matrix, n_runs=5, atol=5e-07, rtol=5e-07)
3737

3838

3939
@mark.parametrize(["aggregator", "matrix"], typical_pairs)

tests/utils/architectures.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,11 @@ class WithBuffered(ShapedModule):
596596
OUTPUT_SHAPES = (10,)
597597

598598
class _Buffered(nn.Module):
599+
buffer: Tensor
600+
599601
def __init__(self):
600602
super().__init__()
601-
self.buffer = nn.Buffer(torch.tensor(1.5))
603+
self.register_buffer("buffer", torch.tensor(1.5))
602604

603605
def forward(self, input: Tensor) -> Tensor:
604606
return input * self.buffer
@@ -637,7 +639,7 @@ class WithSideEffect(ShapedModule):
637639
def __init__(self):
638640
super().__init__()
639641
self.matrix = nn.Parameter(torch.randn(9, 10))
640-
self.buffer = nn.Buffer(torch.zeros((9,)))
642+
self.register_buffer("buffer", torch.zeros((9,)))
641643

642644
def forward(self, input: Tensor) -> Tensor:
643645
self.buffer = self.buffer + 1.0

0 commit comments

Comments
 (0)