MCPcopy Index your code
hub / github.com/AvivNavon/nash-mtl

github.com/AvivNavon/nash-mtl @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
137 symbols 392 edges 19 files 28 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Nash-MTL

Official implementation of "Multi-Task Learning as a Bargaining Game".

<img src="https://github.com/AvivNavon/nash-mtl/blob/main/misc/toy_pareto_2d.png" width="800">

Setup environment

conda create -n nashmtl python=3.9.7
conda activate nashmtl
conda install pytorch==1.9.0 torchvision==0.10.0 cudatoolkit=10.2 -c pytorch
conda install pyg -c pyg -c conda-forge

Install the repo:

git clone https://github.com/AvivNavon/nash-mtl.git
cd nash-mtl
pip install -e .

Run experiment

To run experiments:

cd experiment/<experiment name>
python trainer.py --method=nashmtl

Follow instruction on the experiment README file for more information regarding, e.g., datasets.

Here <experiment name> is one of [toy, quantum_chemistry, nyuv2]. You can also replace nashmtl with on of the following MTL methods.

We also support experiment tracking with Weights & Biases with two additional parameters:

python trainer.py --method=nashmtl --wandb_project=<project-name> --wandb_entity=<entity-name>

MTL methods

We support the following MTL methods with a unified API. To run experiment with MTL method X simply run:

python trainer.py --method=X
Method (code name) Paper (notes)
Nash-MTL (nashmtl) Multi-Task Learning as a Bargaining Game
CAGrad (cagrad) Conflict-Averse Gradient Descent for Multi-task Learning
PCGrad (pcgrad) Gradient Surgery for Multi-Task Learning
IMTL-G (imtl) Towards Impartial Multi-task Learning
MGDA (mgda) Multi-Task Learning as Multi-Objective Optimization
DWA (dwa) End-to-End Multi-Task Learning with Attention
Uncertainty weighting (uw) Multi-Task Learning Using Uncertainty to Weigh Losses for Scene Geometry and Semantics
Linear scalarization (ls) - (equal weighting)
Scale-invariant baseline (scaleinvls) - (see Nash-MTL paper for details)
Random Loss Weighting (rlw) A Closer Look at Loss Weighting in Multi-Task Learning

Citation

If you find Nash-MTL to be useful in your own research, please consider citing the following paper:

@article{navon2022multi,
  title={Multi-Task Learning as a Bargaining Game},
  author={Navon, Aviv and Shamsian, Aviv and Achituve, Idan and Maron, Haggai and Kawaguchi, Kenji and Chechik, Gal and Fetaya, Ethan},
  journal={arXiv preprint arXiv:2202.01017},
  year={2022}
}

Core symbols most depended-on inside this repo

conv_layer
called by 21
experiments/nyuv2/models.py
conv_layer
called by 12
experiments/nyuv2/models.py
parameters
called by 12
methods/weight_methods.py
att_layer
called by 6
experiments/nyuv2/models.py
calc_loss
called by 6
experiments/nyuv2/trainer.py
backward
called by 5
methods/weight_methods.py
backward
called by 4
methods/weight_methods.py
set_logger
called by 3
experiments/utils.py

Shape

Method 92
Class 25
Function 20

Languages

Python100%

Modules by API surface

methods/weight_methods.py60 symbols
experiments/nyuv2/models.py23 symbols
methods/min_norm_solvers.py8 symbols
experiments/utils.py8 symbols
experiments/quantum_chemistry/models.py7 symbols
experiments/nyuv2/utils.py7 symbols
experiments/nyuv2/data.py7 symbols
experiments/quantum_chemistry/utils.py6 symbols
experiments/toy/problem.py4 symbols
experiments/quantum_chemistry/trainer.py2 symbols
experiments/nyuv2/trainer.py2 symbols
setup.py1 symbols

For agents

$ claude mcp add nash-mtl \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact