├── .gitignore ├── LICENSE ├── README.md ├── clip ├── __init__.py ├── bpe_simple_vocab_16e6.txt.gz ├── clip.py ├── model.py └── simple_tokenizer.py ├── configs ├── datasets │ ├── oh.yaml │ ├── p_air.yaml │ ├── p_cars.yaml │ ├── p_ctech.yaml │ ├── p_ins.yaml │ ├── p_mam.yaml │ ├── p_pets.yaml │ ├── p_ucf.yaml │ └── pacs.yaml ├── hparam │ ├── mcunet.yaml │ ├── mcunet_efdmix_l12.yaml │ ├── mcunet_ms_l12.yaml │ ├── mobilenet_v2_tiny.yaml │ ├── mobilenet_v2_tiny_efdmix_l12.yaml │ ├── mobilenet_v2_tiny_ms_l12.yaml │ ├── mobilenet_v3_small.yaml │ ├── mobilenet_v3_small_efdmix_l12.yaml │ ├── mobilenet_v3_small_ms_l12.yaml │ ├── resnet50.yaml │ ├── resnet50_efdmix_l12.yaml │ └── resnet50_ms_l12.yaml └── prompts │ ├── CoCoOp │ ├── rn101_ctxv1.yaml │ ├── rn50_ctxv1.yaml │ ├── vit_b16_ctxv1.yaml │ └── vit_b32_ctxv1.yaml │ └── CoOp │ ├── rn101_ctxv1.yaml │ ├── rn50_ctxv1.yaml │ ├── vit_b16_ctxv1.yaml │ └── vit_b32_ctxv1.yaml ├── datasets ├── __init__.py ├── p_air.py ├── p_cars.py ├── p_ctech.py ├── p_ins.py ├── p_mam.py ├── p_pets.py └── p_ucf.py ├── models ├── __init__.py ├── mobilenetv3.py ├── resnet.py └── tinynn │ ├── __init__.py │ ├── layers.py │ ├── mbv2.py │ ├── mbv3.py │ ├── mcunet.py │ ├── proxylessnas.py │ ├── tiny_mbv2.py │ └── utils.py ├── op_counter.py ├── parse_test_res.py ├── requirements.txt ├── scripts ├── generic.sh ├── kd.sh ├── okd.sh └── prompts │ ├── cocoop.sh │ ├── coop.sh │ └── zeroshot.sh ├── speech ├── README.md ├── core.py ├── dataset.py ├── download.py ├── main.py ├── model.py └── scripts.txt ├── tools ├── featext.py └── models_vit.py ├── train.py └── trainers ├── __init__.py ├── dg ├── __init__.py └── rsc.py ├── kd ├── attention.py ├── crd.py ├── crd_tools │ ├── __init__.py │ ├── criterion.py │ └── memory.py ├── fitnet.py ├── kd.py ├── pkt.py ├── rkd.py ├── similarity.py └── vid.py ├── ours ├── __init__.py └── okd.py └── prompts ├── cocoop.py ├── coop.py └── zsclip.py /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/.gitignore -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/README.md -------------------------------------------------------------------------------- /clip/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip import * 2 | -------------------------------------------------------------------------------- /clip/bpe_simple_vocab_16e6.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/clip/bpe_simple_vocab_16e6.txt.gz -------------------------------------------------------------------------------- /clip/clip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/clip/clip.py -------------------------------------------------------------------------------- /clip/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/clip/model.py -------------------------------------------------------------------------------- /clip/simple_tokenizer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/clip/simple_tokenizer.py -------------------------------------------------------------------------------- /configs/datasets/oh.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/oh.yaml -------------------------------------------------------------------------------- /configs/datasets/p_air.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_air.yaml -------------------------------------------------------------------------------- /configs/datasets/p_cars.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_cars.yaml -------------------------------------------------------------------------------- /configs/datasets/p_ctech.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_ctech.yaml -------------------------------------------------------------------------------- /configs/datasets/p_ins.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_ins.yaml -------------------------------------------------------------------------------- /configs/datasets/p_mam.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_mam.yaml -------------------------------------------------------------------------------- /configs/datasets/p_pets.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_pets.yaml -------------------------------------------------------------------------------- /configs/datasets/p_ucf.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/p_ucf.yaml -------------------------------------------------------------------------------- /configs/datasets/pacs.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/datasets/pacs.yaml -------------------------------------------------------------------------------- /configs/hparam/mcunet.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mcunet.yaml -------------------------------------------------------------------------------- /configs/hparam/mcunet_efdmix_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mcunet_efdmix_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/mcunet_ms_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mcunet_ms_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v2_tiny.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v2_tiny.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v2_tiny_efdmix_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v2_tiny_efdmix_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v2_tiny_ms_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v2_tiny_ms_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v3_small.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v3_small.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v3_small_efdmix_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v3_small_efdmix_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/mobilenet_v3_small_ms_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/mobilenet_v3_small_ms_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/resnet50.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/resnet50.yaml -------------------------------------------------------------------------------- /configs/hparam/resnet50_efdmix_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/resnet50_efdmix_l12.yaml -------------------------------------------------------------------------------- /configs/hparam/resnet50_ms_l12.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/hparam/resnet50_ms_l12.yaml -------------------------------------------------------------------------------- /configs/prompts/CoCoOp/rn101_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoCoOp/rn101_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoCoOp/rn50_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoCoOp/rn50_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoCoOp/vit_b16_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoCoOp/vit_b16_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoCoOp/vit_b32_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoCoOp/vit_b32_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoOp/rn101_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoOp/rn101_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoOp/rn50_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoOp/rn50_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoOp/vit_b16_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoOp/vit_b16_ctxv1.yaml -------------------------------------------------------------------------------- /configs/prompts/CoOp/vit_b32_ctxv1.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/configs/prompts/CoOp/vit_b32_ctxv1.yaml -------------------------------------------------------------------------------- /datasets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /datasets/p_air.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_air.py -------------------------------------------------------------------------------- /datasets/p_cars.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_cars.py -------------------------------------------------------------------------------- /datasets/p_ctech.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_ctech.py -------------------------------------------------------------------------------- /datasets/p_ins.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_ins.py -------------------------------------------------------------------------------- /datasets/p_mam.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_mam.py -------------------------------------------------------------------------------- /datasets/p_pets.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_pets.py -------------------------------------------------------------------------------- /datasets/p_ucf.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/datasets/p_ucf.py -------------------------------------------------------------------------------- /models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /models/mobilenetv3.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/mobilenetv3.py -------------------------------------------------------------------------------- /models/resnet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/resnet.py -------------------------------------------------------------------------------- /models/tinynn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/__init__.py -------------------------------------------------------------------------------- /models/tinynn/layers.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/layers.py -------------------------------------------------------------------------------- /models/tinynn/mbv2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/mbv2.py -------------------------------------------------------------------------------- /models/tinynn/mbv3.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/mbv3.py -------------------------------------------------------------------------------- /models/tinynn/mcunet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/mcunet.py -------------------------------------------------------------------------------- /models/tinynn/proxylessnas.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/proxylessnas.py -------------------------------------------------------------------------------- /models/tinynn/tiny_mbv2.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/tiny_mbv2.py -------------------------------------------------------------------------------- /models/tinynn/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/models/tinynn/utils.py -------------------------------------------------------------------------------- /op_counter.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/op_counter.py -------------------------------------------------------------------------------- /parse_test_res.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/parse_test_res.py -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | thop 2 | tabulate 3 | -------------------------------------------------------------------------------- /scripts/generic.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/generic.sh -------------------------------------------------------------------------------- /scripts/kd.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/kd.sh -------------------------------------------------------------------------------- /scripts/okd.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/okd.sh -------------------------------------------------------------------------------- /scripts/prompts/cocoop.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/prompts/cocoop.sh -------------------------------------------------------------------------------- /scripts/prompts/coop.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/prompts/coop.sh -------------------------------------------------------------------------------- /scripts/prompts/zeroshot.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/scripts/prompts/zeroshot.sh -------------------------------------------------------------------------------- /speech/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/README.md -------------------------------------------------------------------------------- /speech/core.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/core.py -------------------------------------------------------------------------------- /speech/dataset.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/dataset.py -------------------------------------------------------------------------------- /speech/download.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/download.py -------------------------------------------------------------------------------- /speech/main.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/main.py -------------------------------------------------------------------------------- /speech/model.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/model.py -------------------------------------------------------------------------------- /speech/scripts.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/speech/scripts.txt -------------------------------------------------------------------------------- /tools/featext.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/tools/featext.py -------------------------------------------------------------------------------- /tools/models_vit.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/tools/models_vit.py -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/train.py -------------------------------------------------------------------------------- /trainers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/dg/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/dg/rsc.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/dg/rsc.py -------------------------------------------------------------------------------- /trainers/kd/attention.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/attention.py -------------------------------------------------------------------------------- /trainers/kd/crd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/crd.py -------------------------------------------------------------------------------- /trainers/kd/crd_tools/__init__.py: -------------------------------------------------------------------------------- 1 | from .criterion import CRDLoss -------------------------------------------------------------------------------- /trainers/kd/crd_tools/criterion.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/crd_tools/criterion.py -------------------------------------------------------------------------------- /trainers/kd/crd_tools/memory.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/crd_tools/memory.py -------------------------------------------------------------------------------- /trainers/kd/fitnet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/fitnet.py -------------------------------------------------------------------------------- /trainers/kd/kd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/kd.py -------------------------------------------------------------------------------- /trainers/kd/pkt.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/pkt.py -------------------------------------------------------------------------------- /trainers/kd/rkd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/rkd.py -------------------------------------------------------------------------------- /trainers/kd/similarity.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/similarity.py -------------------------------------------------------------------------------- /trainers/kd/vid.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/kd/vid.py -------------------------------------------------------------------------------- /trainers/ours/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /trainers/ours/okd.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/ours/okd.py -------------------------------------------------------------------------------- /trainers/prompts/cocoop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/prompts/cocoop.py -------------------------------------------------------------------------------- /trainers/prompts/coop.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/prompts/coop.py -------------------------------------------------------------------------------- /trainers/prompts/zsclip.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KaiyangZhou/on-device-dg/HEAD/trainers/prompts/zsclip.py --------------------------------------------------------------------------------