Views
No views yet
T task vectors (one per dataset) into M = T/2 basis vectors,
built from CLIP image encoders fine-tuned on the standard vision benchmark. Loading a
basis lets you do task addition and negation at a fraction of the storage of
keeping all T task vectors.{model}_{method}_M{M}_{T}task:model ∈ {ViT-B-16, ViT-B-32, ViT-L-14}method ∈ {AE (Autoencoder / Gram), PCA}M = number of basis vectors (= T/2)T ∈ {8, 14, 20} tasks (seed 0)ViT-B-32_AE_M4_8task, ViT-L-14_PCA_M10_20task.| file | purpose |
|---|---|
basis_vectors.pt | the M basis vectors — used for addition (required) |
method_info.json | method, hyperparameters, and the dataset order used at build time |
AWB.pt / pca_components.pt | method-specific artifact — needed to recover per-task vectors for negation |
1from huggingface_hub import snapshot_download
2from src.basis_vectors import BasisMethod
3from src.task_vectors import NonLinearTaskVector
4from src.basis_pipeline import load_and_recover_from_saved_basis
5
6name = "ViT-B-32_AE_M4_8task"
7local = snapshot_download("cindy2000sh/TaskVectorBasis-checkpoints", allow_patterns=[f"{name}/*"])
8basis_dir = f"{local}/{name}"
9
10# Task addition: sum the M basis vectors into one merged task vector.
11merged = sum(NonLinearTaskVector(vector=bv) for bv in BasisMethod.load_basis_vectors(basis_dir))
12# image_encoder = merged.apply_to("checkpoints/ViT-B-32/zeroshot.pt", scaling_coef=0.4)
13
14# Task negation: recover the per-task vectors from the basis, then negate.
15recovered = load_and_recover_from_saved_basis(run_dir=basis_dir)
16# neg = -NonLinearTaskVector(vector=recovered[0])python scripts/load_basis.py --hf-repo cindy2000sh/TaskVectorBasis-checkpoints --hf-subdir ViT-B-32_AE_M4_8task1@article{zeng2025task,
2 title={Task Vector Bases: A Unified and Scalable Framework for Compressed Task Arithmetic},
3 author={Zeng, Siqi and He, Yifei and Liu, Meitong and You, Weiqiu and Hao, Yifan and Tsai, Yao-Hung Hubert and Yamada, Makoto and Zhao, Han},
4 journal={arXiv preprint arXiv:2502.01015},
5 year={2025}
6}