DeCLIP-TPAMI / scripts /tinyclip_declip_plus /tinyclip_vit39m_coco.sh
xiaomoguhzz's picture
Add files using upload-large-folder tool
c50dde6 verified
# GPU selection (e.g., 0, 1, 2, 3 or 0,1 for multiple GPUs)
gpu=1
# Training parameters
# Mode options: qq, kk, vv, csa, qq_vfm_distill, kk_vfm_distill, vv_vfm_distill, csa_vfm_distill, all_vfm_distill, maskclip, vanilla, sanity_check
mode=csa_vfm_distill
det_image_size=560
loss_context_weight=0.25
loss_content_weight=1.0
loss_region_weight=0.1
# DeCLIP_PLUS specific parameters
sd_refine_weight=1.0
repa_layer_idx=-1 # -1 means not using REPA, set to layer index if using REPA
cache_self_attn=/mnt/SSD8T/home/wjj/code/DeCLIP/sd_self_attn_cache/sd_self_attn_coco.h5 # Path to SD self-attention cache
# Dataset and model paths
data_root=/opt/tiger/xiaomoguhzz/standard_coco
pretrain_ckpt=checkpoints/TinyCLIP-ViT-39M-16-Text-19M-YFCC15M.pt
vfm_type=dinov2-B # {sam-B, sam-L, dinov2-B, dinov2-L, dino-B-8, dino-B-16}
model_name=TinyCLIP-ViT-39M-16-Text-19M
embed_path=metadata/coco_panoptic_clip_hand_craft_TinyCLIP-ViT-39M-16-Text-19M.npy
# Dataset type: dift_grid_distill or dift_proposals_distill (both support sd_attn)
dataset_type=dift_grid_distill
# Extract mode name for exp_name (remove _vfm_distill suffix if present)
mode_name=${mode%_vfm_distill}
exp_name=TinyCLIP_39M_DeCLIP+_dinov2B_${mode_name}_${det_image_size}_${loss_context_weight}_${loss_content_weight}_${loss_region_weight}
# Single GPU for debugging
CUDA_VISIBLE_DEVICES=${gpu} python -m training.main --batch-size=2 --lr=1e-5 --wd=0.1 --epochs=6 --workers=4 \
--model ${model_name} --pretrained ${pretrain_ckpt} --warmup 1000 --zeroshot-frequency 1 --dataset-type ${dataset_type} \
--test-type coco_panoptic --train-data ${data_root}/annotations/instances_train2017.json \
--val-data ${data_root}/annotations/panoptic_val2017.json \
--embed-path ${embed_path} --train-image-root ${data_root}/train2017 \
--val-image-root ${data_root}/val2017 --cache-dir ${pretrain_ckpt} --log-every-n-steps 100 \
--lock-image --save-frequency 1 --lock-image-unlocked-groups 12 \
--name ${exp_name} --downsample-factor 16 --det-image-size ${det_image_size} --val-segm-root ${data_root}/annotations/panoptic_val2017 \
--alpha 0.7 --mode ${mode} --use_vfm ${vfm_type} \
--loss_context_weight ${loss_context_weight} --loss_content_weight ${loss_content_weight} --loss_region_weight ${loss_region_weight} \
--version declip+ --cache-self-attn ${cache_self_attn} --sd-refine-weight ${sd_refine_weight} --repa_layer_idx ${repa_layer_idx}