Skip to content

Commit b4a6826

Browse files
ci: Add link checker (#546)
* ci: Add a link checker for the doc * Fix 403 error for MGDA reference * Remove reference to the AlignedMTL repo. * Fix links in README.md * Fix link in CHANGELOG.md ---------- Co-authored-by: Valérian Rey <valerian.rey@gmail.com>
1 parent a55afca commit b4a6826

File tree

5 files changed

+40
-10
lines changed

5 files changed

+40
-10
lines changed

.github/workflows/tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,35 @@ jobs:
7777
working-directory: docs
7878
run: uv run make dirhtml
7979

80+
check-links:
81+
name: Check no link is broken
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
# This will restore the cache for the current commit if it exists, or the most recent lychee
88+
# cache otherwise (including those saved for the main branch). It will also save the cache for
89+
# the current commit if none existed for it, and only if the link check succeeded. We don't
90+
# want to save a cache when the action failed, because the reason for failure might be
91+
# temporary (rate limiting, network issue, etc.), and we always want to retry those links
92+
# everytime this action is run.
93+
- name: Restore lychee cache
94+
uses: actions/cache@v4
95+
with:
96+
path: .lycheecache
97+
key: cache-lychee-${{ github.sha }}
98+
restore-keys: cache-lychee-
99+
100+
- name: Run lychee
101+
uses: lycheeverse/lychee-action@v2
102+
with:
103+
args: --verbose --no-progress --cache --max-cache-age 1d "." --exclude-path "docs/source/_templates/page.html"
104+
fail: true
105+
env:
106+
# This reduces false positives due to rate limits
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
80109
mypy:
81110
name: Run mypy
82111
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Informed Neural Networks](https://arxiv.org/pdf/2408.11104).
299299
- `Aggregator` base class to aggregate Jacobian matrices.
300300
- `AlignedMTL` from [Independent Component
301301
Alignment for Multi-Task Learning](
302-
https://openaccess.thecvf.com/content/CVPR2023/papers/Senushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.pdf>).
302+
https://openaccess.thecvf.com/content/CVPR2023/papers/Senushkin_Independent_Component_Alignment_for_Multi-Task_Learning_CVPR_2023_paper.pdf).
303303
- `CAGrad` from [Conflict-Averse Gradient Descent for Multi-task
304304
Learning](https://arxiv.org/pdf/2110.14048.pdf).
305305
- `Constant` to aggregate with constant weights.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ There are two main ways to use TorchJD. The first one is to replace the usual ca
6363
[`torchjd.autojac.mtl_backward`](https://torchjd.org/stable/docs/autojac/mtl_backward/), depending
6464
on the use-case. This will compute the Jacobian of the vector of losses with respect to the model
6565
parameters, and aggregate it with the specified
66-
[`Aggregator`](https://torchjd.org/stable/docs/aggregation/index.html#torchjd.aggregation.Aggregator).
66+
[`Aggregator`](https://torchjd.org/stable/docs/aggregation#torchjd.aggregation.Aggregator).
6767
Whenever you want to optimize the vector of per-sample losses, you should rather use the
68-
[`torchjd.autogram.Engine`](https://torchjd.org/stable/docs/autogram/engine.html). Instead of
68+
[`torchjd.autogram.Engine`](https://torchjd.org/stable/docs/autogram/engine/). Instead of
6969
computing the full Jacobian at once, it computes the Gramian of this Jacobian, layer by layer, in a
7070
memory-efficient way. A vector of weights (one per element of the batch) can then be extracted from
7171
this Gramian, using a
72-
[`Weighting`](https://torchjd.org/stable/docs/aggregation/index.html#torchjd.aggregation.Weighting),
72+
[`Weighting`](https://torchjd.org/stable/docs/aggregation#torchjd.aggregation.Weighting),
7373
and used to combine the losses of the batch. Assuming each element of the batch is
7474
processed independently from the others, this approach is equivalent to
7575
[`torchjd.autojac.backward`](https://torchjd.org/stable/docs/autojac/backward/) while being
@@ -210,7 +210,7 @@ for input, target1, target2 in zip(inputs, task1_targets, task2_targets):
210210
> [!NOTE]
211211
> Here, because the losses are a matrix instead of a simple vector, we compute a *generalized
212212
> Gramian* and we extract weights from it using a
213-
> [GeneralizedWeighting](https://torchjd.org/docs/aggregation/index.html#torchjd.aggregation.GeneralizedWeighting).
213+
> [GeneralizedWeighting](https://torchjd.org/stable/docs/aggregation/#torchjd.aggregation.GeneralizedWeighting).
214214
215215
More usage examples can be found [here](https://torchjd.org/stable/examples/).
216216

@@ -220,7 +220,7 @@ TorchJD provides many existing aggregators from the literature, listed in the fo
220220
<!-- recommended aggregators first, then alphabetical order -->
221221
| Aggregator | Weighting | Publication |
222222
|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
223-
| [UPGrad](https://torchjd.org/stable/docs/aggregation/upgrad.html#torchjd.aggregation.UPGrad) (recommended) | [UPGradWeighting](https://torchjd.org/stable/docs/aggregation/upgrad#torchjd.aggregation.UPGradWeighting) | [Jacobian Descent For Multi-Objective Optimization](https://arxiv.org/pdf/2406.16232) |
223+
| [UPGrad](https://torchjd.org/stable/docs/aggregation/upgrad/#torchjd.aggregation.UPGrad) (recommended) | [UPGradWeighting](https://torchjd.org/stable/docs/aggregation/upgrad/#torchjd.aggregation.UPGradWeighting) | [Jacobian Descent For Multi-Objective Optimization](https://arxiv.org/pdf/2406.16232) |
224224
| [AlignedMTL](https://torchjd.org/stable/docs/aggregation/aligned_mtl#torchjd.aggregation.AlignedMTL) | [AlignedMTLWeighting](https://torchjd.org/stable/docs/aggregation/aligned_mtl#torchjd.aggregation.AlignedMTLWeighting) | [Independent Component Alignment for Multi-Task Learning](https://arxiv.org/pdf/2305.19000) |
225225
| [CAGrad](https://torchjd.org/stable/docs/aggregation/cagrad#torchjd.aggregation.CAGrad) | [CAGradWeighting](https://torchjd.org/stable/docs/aggregation/cagrad#torchjd.aggregation.CAGradWeighting) | [Conflict-Averse Gradient Descent for Multi-task Learning](https://arxiv.org/pdf/2110.14048) |
226226
| [ConFIG](https://torchjd.org/stable/docs/aggregation/config#torchjd.aggregation.ConFIG) | - | [ConFIG: Towards Conflict-free Training of Physics Informed Neural Networks](https://arxiv.org/pdf/2408.11104) |

src/torchjd/aggregation/_aligned_mtl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class AlignedMTL(GramianWeightedAggregator):
5151
uses the mean eigenvalue (as in the original implementation).
5252
5353
.. note::
54-
This implementation was adapted from the `official implementation
55-
<https://github.com/SamsungLabs/MTL/tree/master/code/optim/aligned>`_.
54+
This implementation was adapted from the official implementation of SamsungLabs/MTL,
55+
which is not available anymore at the time of writing.
5656
"""
5757

5858
def __init__(

src/torchjd/aggregation/_mgda.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ class MGDA(GramianWeightedAggregator):
1111
r"""
1212
:class:`~torchjd.aggregation._aggregator_bases.Aggregator` performing the gradient aggregation
1313
step of `Multiple-gradient descent algorithm (MGDA) for multiobjective optimization
14-
<https://www.sciencedirect.com/science/article/pii/S1631073X12000738>`_. The implementation is
15-
based on Algorithm 2 of `Multi-Task Learning as Multi-Objective Optimization
14+
<https://comptes-rendus.academie-sciences.fr/mathematique/articles/10.1016/j.crma.2012.03.014/>`_.
15+
The implementation is based on Algorithm 2 of `Multi-Task Learning as Multi-Objective
16+
Optimization
1617
<https://proceedings.neurips.cc/paper_files/paper/2018/file/432aca3a1e345e339f35a30c8f65edce-Paper.pdf>`_.
1718
1819
:param epsilon: The value of :math:`\hat{\gamma}` below which we stop the optimization.

0 commit comments

Comments
 (0)