Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crisostomi/task-vectors-playground


https://github.com/crisostomi/task-vectors-playground

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# Task Vectors Playground


CI
Docs
NN Template
Python
Code style: black

Playing with those task vectors

## Development installation

Setup the development environment:

```bash
git clone [email protected]:crisostomi/task-vectors-playground.git
cd task-vectors-playground
conda env create -f env.yaml
conda activate tvp
```

## Fine-tuning
First, choose a vision encoder in `{"ViT-B-16", "ViT-B-32", "ViT-L-14"}`. Check that the corresponding WandB artifact is present online (at the time of writing, only `ViT-B-16` is available).

Now choose one or more datasets for which you want to compute the task vectors, and set it in `conf/nn/data/default.yaml` under the `dataset` voice in the defaults. Currently available datasets are `{'svhn', 'mnist', 'cifar100', 'resisc45'}`, but any dataset in `tvp/data/datasets/*` can be used. It is enough to create the corresponding configuration file in `conf/nn/data/dataset/`.

Before fine-tuning the model on the dataset, check if the fine-tuned version is already among the artifacts in WandB. It should be named `__`. If it is not, use `src/scripts/finetune.py` to fine-tune the pretrained model over the chosen dataset. The corresponding configuration is `conf/finetune.yaml`.

## Applying task-vectors
Now the script is `src/scripts/use_task_vectors.py` and the configuration is `conf/task_vectors.yaml`. Task vectors to apply can be chosen in the `task_vectors.to_apply` voice in the config, which expects a list of dataset names.