├── .vscode └── launch.json ├── README.md ├── clip ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-38.pyc │ ├── clip.cpython-38.pyc │ ├── model.cpython-38.pyc │ ├── model_original.cpython-38.pyc │ └── simple_tokenizer.cpython-38.pyc ├── bpe_simple_vocab_16e6.txt.gz ├── clip.py ├── model.py └── simple_tokenizer.py ├── clip_words.csv ├── configs ├── datasets │ ├── caltech101.yaml │ ├── dtd.yaml │ ├── eurosat.yaml │ ├── fgvc_aircraft.yaml │ ├── food101.yaml │ ├── imagenet.yaml │ ├── imagenet_a.yaml │ ├── imagenet_r.yaml │ ├── imagenet_sketch.yaml │ ├── imagenetv2.yaml │ ├── oxford_flowers.yaml │ ├── oxford_pets.yaml │ ├── stanford_cars.yaml │ ├── sun397.yaml │ └── ucf101.yaml └── trainers │ └── CMPA │ └── vit_b16_c2_ep20_batch4_16ctx.yaml ├── datasets ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-38.pyc │ ├── caltech101.cpython-38.pyc │ ├── dtd.cpython-38.pyc │ ├── eurosat.cpython-38.pyc │ ├── fgvc_aircraft.cpython-38.pyc │ ├── food101.cpython-38.pyc │ ├── imagenet.cpython-38.pyc │ ├── imagenet_a.cpython-38.pyc │ ├── imagenet_r.cpython-38.pyc │ ├── imagenet_sketch.cpython-38.pyc │ ├── imagenetv2.cpython-38.pyc │ ├── oxford_flowers.cpython-38.pyc │ ├── oxford_pets.cpython-38.pyc │ ├── stanford_cars.cpython-38.pyc │ ├── sun397.cpython-38.pyc │ └── ucf101.cpython-38.pyc ├── caltech101.py ├── dtd.py ├── eurosat.py ├── fgvc_aircraft.py ├── food101.py ├── imagenet.py ├── imagenet_a.py ├── imagenet_r.py ├── imagenet_sketch.py ├── imagenetv2.py ├── oxford_flowers.py ├── oxford_pets.py ├── stanford_cars.py ├── sun397.py └── ucf101.py ├── docs ├── Co-CoOp.md ├── CoOp.md ├── DATASETS.md ├── INSTALL.md └── RUN.md ├── interpret_prompts ├── clip_words.csv └── interpret_prompt.py ├── parse_test_res.py ├── requirements.txt ├── scripts └── cmpa │ ├── eval.sh │ ├── main.sh │ └── xd_test.sh ├── train.py └── trainers ├── __init__.py └── cmpa.py /.vscode/launch.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/.vscode/launch.json -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/README.md -------------------------------------------------------------------------------- /clip/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip import * 2 | -------------------------------------------------------------------------------- /clip/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /clip/__pycache__/clip.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/__pycache__/clip.cpython-38.pyc -------------------------------------------------------------------------------- /clip/__pycache__/model.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/__pycache__/model.cpython-38.pyc -------------------------------------------------------------------------------- /clip/__pycache__/model_original.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/__pycache__/model_original.cpython-38.pyc -------------------------------------------------------------------------------- /clip/__pycache__/simple_tokenizer.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/__pycache__/simple_tokenizer.cpython-38.pyc -------------------------------------------------------------------------------- /clip/bpe_simple_vocab_16e6.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/bpe_simple_vocab_16e6.txt.gz -------------------------------------------------------------------------------- /clip/clip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/clip.py -------------------------------------------------------------------------------- /clip/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/model.py -------------------------------------------------------------------------------- /clip/simple_tokenizer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip/simple_tokenizer.py -------------------------------------------------------------------------------- /clip_words.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/clip_words.csv -------------------------------------------------------------------------------- /configs/datasets/caltech101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "Caltech101" 3 | -------------------------------------------------------------------------------- /configs/datasets/dtd.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "DescribableTextures" 3 | -------------------------------------------------------------------------------- /configs/datasets/eurosat.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "EuroSAT" 3 | -------------------------------------------------------------------------------- /configs/datasets/fgvc_aircraft.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "FGVCAircraft" 3 | -------------------------------------------------------------------------------- /configs/datasets/food101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "Food101" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNet" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet_a.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetA" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet_r.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetR" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenet_sketch.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetSketch" 3 | -------------------------------------------------------------------------------- /configs/datasets/imagenetv2.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "ImageNetV2" 3 | -------------------------------------------------------------------------------- /configs/datasets/oxford_flowers.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "OxfordFlowers" -------------------------------------------------------------------------------- /configs/datasets/oxford_pets.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "OxfordPets" -------------------------------------------------------------------------------- /configs/datasets/stanford_cars.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "StanfordCars" 3 | -------------------------------------------------------------------------------- /configs/datasets/sun397.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "SUN397" 3 | -------------------------------------------------------------------------------- /configs/datasets/ucf101.yaml: -------------------------------------------------------------------------------- 1 | DATASET: 2 | NAME: "UCF101" 3 | -------------------------------------------------------------------------------- /configs/trainers/CMPA/vit_b16_c2_ep20_batch4_16ctx.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/configs/trainers/CMPA/vit_b16_c2_ep20_batch4_16ctx.yaml -------------------------------------------------------------------------------- /datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /datasets/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/caltech101.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/caltech101.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/dtd.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/dtd.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/eurosat.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/eurosat.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/fgvc_aircraft.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/fgvc_aircraft.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/food101.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/food101.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/imagenet.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/imagenet.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/imagenet_a.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/imagenet_a.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/imagenet_r.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/imagenet_r.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/imagenet_sketch.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/imagenet_sketch.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/imagenetv2.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/imagenetv2.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/oxford_flowers.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/oxford_flowers.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/oxford_pets.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/oxford_pets.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/stanford_cars.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/stanford_cars.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/sun397.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/sun397.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/__pycache__/ucf101.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/__pycache__/ucf101.cpython-38.pyc -------------------------------------------------------------------------------- /datasets/caltech101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/caltech101.py -------------------------------------------------------------------------------- /datasets/dtd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/dtd.py -------------------------------------------------------------------------------- /datasets/eurosat.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/eurosat.py -------------------------------------------------------------------------------- /datasets/fgvc_aircraft.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/fgvc_aircraft.py -------------------------------------------------------------------------------- /datasets/food101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/food101.py -------------------------------------------------------------------------------- /datasets/imagenet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/imagenet.py -------------------------------------------------------------------------------- /datasets/imagenet_a.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/imagenet_a.py -------------------------------------------------------------------------------- /datasets/imagenet_r.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/imagenet_r.py -------------------------------------------------------------------------------- /datasets/imagenet_sketch.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/imagenet_sketch.py -------------------------------------------------------------------------------- /datasets/imagenetv2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/imagenetv2.py -------------------------------------------------------------------------------- /datasets/oxford_flowers.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/oxford_flowers.py -------------------------------------------------------------------------------- /datasets/oxford_pets.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/oxford_pets.py -------------------------------------------------------------------------------- /datasets/stanford_cars.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/stanford_cars.py -------------------------------------------------------------------------------- /datasets/sun397.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/sun397.py -------------------------------------------------------------------------------- /datasets/ucf101.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/datasets/ucf101.py -------------------------------------------------------------------------------- /docs/Co-CoOp.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/docs/Co-CoOp.md -------------------------------------------------------------------------------- /docs/CoOp.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/docs/CoOp.md -------------------------------------------------------------------------------- /docs/DATASETS.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/docs/DATASETS.md -------------------------------------------------------------------------------- /docs/INSTALL.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/docs/INSTALL.md -------------------------------------------------------------------------------- /docs/RUN.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/docs/RUN.md -------------------------------------------------------------------------------- /interpret_prompts/clip_words.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/interpret_prompts/clip_words.csv -------------------------------------------------------------------------------- /interpret_prompts/interpret_prompt.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/interpret_prompts/interpret_prompt.py -------------------------------------------------------------------------------- /parse_test_res.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/parse_test_res.py -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ftfy==6.1.1 2 | regex 3 | tqdm 4 | -------------------------------------------------------------------------------- /scripts/cmpa/eval.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/scripts/cmpa/eval.sh -------------------------------------------------------------------------------- /scripts/cmpa/main.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/scripts/cmpa/main.sh -------------------------------------------------------------------------------- /scripts/cmpa/xd_test.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/scripts/cmpa/xd_test.sh -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/train.py -------------------------------------------------------------------------------- /trainers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/cmpa.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GingL/CMPA/HEAD/trainers/cmpa.py --------------------------------------------------------------------------------