Skip to content

zhangdingchu/Adaprompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robust Test-Time Adaptation for Zero-Shot Prompt Tuning (ADAPROMPT)

This repository provides the official PyTorch implementation of our AAAI 2024 paper:

Robust Test-Time Adaptation for Zero-Shot Prompt Tuning Authors: Ding-Chu Zhang*, Zhi Zhou*, Yu-Feng Li

For more details, please check out our paper.

Environment

Install pip environment

pip install -r requirements.txt

Install conda environment

conda install --yes --file requirements.txt

Datasets

Download the datasets CIFAR10-C, CIFAR100-C,ImageNet-R and TinyImageNet-C.

Download cross-validation datasets by TPT.

Run

  1. Place the dataset in the ./MyDATA folder

  2. Run Adaprompt

    python ./test.py ./MyDATA --test_sets CIFAR10_C -a ViT-B/16 -b 64 --gpu 0 --tpt --ctx_init a_photo_of_a --result-dir ./results/ours --method-config ./configs/methods/ours.yaml

  3. Run TPT

    python ./test.py ./MyDATA --test_sets CIFAR10_C -a ViT-B/16 -b 64 --gpu 0 --tpt --ctx_init a_photo_of_a --result-dir ./results/tpt --method-config ./configs/methods/tpt.yaml

  4. Run Source

    python ./test.py ./MyDATA --test_sets CIFAR10_C -a ViT-B/16 -b 64 --gpu 0 --tpt --ctx_init a_photo_of_a --result-dir ./results/source --method-config ./configs/methods/source.yaml

  5. The results will be printed and stored in ./results/.

Acknowledgment

We thank the authors for the following repositories for code reference: TPT.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published