Task Addition
Task Negation
Model-editing techniques using task arithmetic (Ilharco et al., 2022) have rapidly gained attention. Through task arithmetic, simply through arithmetic operations on the weights of pre-trained and fine-tuned models create desired models, such as multi-task models, models with specific tasks unsolvable, or domain-transferred models. However, task arithmetic faces challenges, such as low reproducibility and the high cost associated with adjusting coefficients in the arithmetic operations on model parameters, which have limited its practical success. In this paper, we present three key contributions in the context of task addition and task negation within task arithmetic. First, we propose a new metric called $\tau$Jp which is based on the product of the task vector (
Create a virtual environment
python3 -m venv tau_jp
Activate the virtual environment
source tau_jp/bin/activate
Install the required packages from requirements.txt
pip install -r requirements.txt
Datasets to download:
We are using the same datasets as this repository.
For Cars, the original download link is broken, so please refer to this issue for a workaround. For DTD, EuroSAT, RESISC45, and SUN397, the datasets need to be manually split after downloading. Please refer to this issue for details.
The contents of this repository are based on Ilharco et al., 2023 and Ortiz-Jimenez et al., 2023 and share the same structure.
with our strict reguralizer
python src/finetune_reg_strict.py --finetuning-mode=linear --model=ViT-B-32 --world-size=2 # Finetune non-linearly on 2 GPUs
with our cyclycal reguralizer
python src/finetune_reg_efficient.py --finetuning-mode=linear --model=ViT-B-32 --world-size=2 # Finetune non-linearly on 2 GPUs