diff --git a/pyproject.toml b/pyproject.toml index b16fdbff..ce3d110e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ Changelog = "https://github.com/SimplexLab/TorchJD/blob/main/CHANGELOG.md" [dependency-groups] check = [ "ruff>=0.14.14", - "ty>=0.0.14", + "ty>=0.0.100", "pre-commit>=2.9.2", # isort doesn't work before 2.9.2 ] @@ -200,4 +200,4 @@ exclude = ["src/torchjd/aggregation/_nash_mtl.py"] [tool.ty.rules] # nn.Module declares `forward` as a mutable `Callable[..., Any]` attribute, so every # `forward` override would be flagged. -invalid-mutable-override = "ignore" +incompatible-mutable-override = "ignore" diff --git a/src/torchjd/autogram/_jacobian_computer.py b/src/torchjd/autogram/_jacobian_computer.py index a8d1e04b..93a6a679 100644 --- a/src/torchjd/autogram/_jacobian_computer.py +++ b/src/torchjd/autogram/_jacobian_computer.py @@ -181,7 +181,7 @@ def vmap( jac_outputs: tuple[Tensor, ...], args: tuple[PyTree, ...], kwargs: dict[str, PyTree], - ) -> tuple[Tensor, None]: # ty: ignore[invalid-method-override] + ) -> tuple[Tensor, None]: # ty: ignore[incompatible-method-override] # There is a non-batched dimension # We do not vmap over the args, kwargs, or rg_outputs for the non-batched dimension generalized_jacobian = torch.vmap(compute_jacobian_fn, in_dims=in_dims[1:])( diff --git a/src/torchjd/autogram/_module_hook_manager.py b/src/torchjd/autogram/_module_hook_manager.py index e07e999d..1b52a3dd 100644 --- a/src/torchjd/autogram/_module_hook_manager.py +++ b/src/torchjd/autogram/_module_hook_manager.py @@ -172,8 +172,8 @@ def forward( def setup_context( ctx: Any, inputs: tuple, - _, - ) -> None: # ty: ignore[invalid-method-override] + output: Any, # noqa: ARG004 + ) -> None: ctx.gramian_accumulation_phase = inputs[0] ctx.gramian_computer = inputs[1] ctx.args = inputs[2] diff --git a/src/torchjd/autojac/_utils.py b/src/torchjd/autojac/_utils.py index 4946b5de..4b347883 100644 --- a/src/torchjd/autojac/_utils.py +++ b/src/torchjd/autojac/_utils.py @@ -176,7 +176,7 @@ def get_leaf_tensors(tensors: Iterable[Tensor], excluded: Iterable[Tensor]) -> O # accumulate_grads contains instances of AccumulateGrad, which contain a `variable` field. # They cannot be typed as such because AccumulateGrad is not public. - leaves = OrderedSet([g.variable for g in accumulate_grads]) # ty: ignore[unresolved-attribute] + leaves = OrderedSet([g.variable for g in accumulate_grads]) # ty: ignore[missing-attribute] return leaves