From 146e775f7581c8f0bcef2d4890a3c138386578b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Sep 2026 02:17:44 +0000 Subject: [PATCH 1/2] Bump https://github.com/astral-sh/ruff-pre-commit from v0.16.0 to 0.16.5 Bumps [https://github.com/astral-sh/ruff-pre-commit](https://github.com/astral-sh/ruff-pre-commit) from v0.16.0 to 0.16.5. - [Release notes](https://github.com/astral-sh/ruff-pre-commit/releases) - [Commits](https://github.com/astral-sh/ruff-pre-commit/compare/v0.16.0...v0.16.5) --- updated-dependencies: - dependency-name: https://github.com/astral-sh/ruff-pre-commit dependency-version: 0.16.5 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 820f6b18..d2f05b11 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: check-merge-conflict # Check for files that contain merge conflict strings. - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.16.0 + rev: v0.16.5 hooks: - id: ruff-check args: [ --fix, --ignore, FIX ] # Allow committing with TODOs. Only CI checks should prevent merging with TODOs. From 74848e930a7da4278109fcd0aa84f2bca25991d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Rey?= Date: Thu, 3 Sep 2026 02:15:17 +0200 Subject: [PATCH 2/2] Apply pre-commit hooks --- CHANGELOG.md | 10 +++++++--- CONTRIBUTING.md | 2 ++ skills/implement-method/references/aggregators.md | 11 +++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccdb521c..fccba32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,16 +117,18 @@ changelog does not include internal changes that do not affect the user. ```python # Before from torchjd.aggregation import Flattening, UPGradWeighting + weighting = Flattening(UPGradWeighting()) gramian = engine.compute_gramian(losses) # shape: [m1, m2, m2, m1] - weights = weighting(gramian) # shape: [m1, m2] + weights = weighting(gramian) # shape: [m1, m2] losses.backward(weights) # After from torchjd.aggregation import UPGradWeighting + weighting = UPGradWeighting() - gramian = engine.compute_gramian(losses) # shape: [m1 * m2, m1 * m2] - weights = weighting(gramian).reshape(losses.shape) # shape: [m1, m2] + gramian = engine.compute_gramian(losses) # shape: [m1 * m2, m1 * m2] + weights = weighting(gramian).reshape(losses.shape) # shape: [m1, m2] losses.backward(weights) ``` @@ -140,11 +142,13 @@ changelog does not include internal changes that do not affect the user. ```python # Before from torchjd.aggregation import UPGrad + aggregator = UPGrad(norm_eps=1e-6, reg_eps=1e-6, solver="quadprog") # After from torchjd.aggregation import UPGrad from torchjd.linalg import QuadprogProjector + aggregator = UPGrad(projector=QuadprogProjector(norm_eps=1e-6, reg_eps=1e-6)) ``` If you used the default `norm_eps`, `reg_eps` and `solver`, you don't have to change anything and diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ae02c2b..d8909f08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -174,11 +174,13 @@ device and dtype, you have to use the partial functions defined in `tests/utils/ instantiate tensors. For instance, instead of ```python import torch + a = torch.ones(3, 4) ``` use ```python from utils.tensors import ones_ + a = ones_(3, 4) ``` diff --git a/skills/implement-method/references/aggregators.md b/skills/implement-method/references/aggregators.md index 43e0eab0..cf122704 100644 --- a/skills/implement-method/references/aggregators.md +++ b/skills/implement-method/references/aggregators.md @@ -119,12 +119,11 @@ allows safe mutation after construction and gives immediate, clear error message def alpha(self) -> float: return self._alpha + @alpha.setter def alpha(self, value: float) -> None: if not (0.0 <= value <= 1.0): - raise ValueError( - f"Attribute `alpha` must be in [0, 1]. Found alpha={value!r}." - ) + raise ValueError(f"Attribute `alpha` must be in [0, 1]. Found alpha={value!r}.") self._alpha = value ``` @@ -164,11 +163,7 @@ already defines `__str__` to return just the class name, and `Weighting` inherit ```python def __repr__(self) -> str: - return ( - f"{self.__class__.__name__}(" - f"alpha={self.alpha!r}, " - f"rho={self.rho!r})" - ) + return f"{self.__class__.__name__}(alpha={self.alpha!r}, rho={self.rho!r})" ``` ---