-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupl_train.sh
40 lines (36 loc) · 1.28 KB
/
upl_train.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
cd ..
# custom config
DATA=./data
TRAINER=UPLTrainer
DATASET=$1
CFG=$2 # config file
CTP=$3 # class token position (end or middle)
NCTX=$4 # number of context tokens
SHOTS=$5 # number of shots (1, 2, 4, 8, 16)
CSC=$6 # class-specific context (False or True)
CLASS_EQULE=$7 # CLASS_EQULE True of False
TAG=$8 # log tag (multiple_models_random_init or rn50_random_init)
FP=$9 # number of false positive training samples per class
for SEED in {1..4}
do
DIR=./output/${DATASET}/${TRAINER}/${CFG}_${SHOTS}shots_EQULE_${CLASS_EQULE}_${CONF_THRESHOLD}_${TAG}/nctx${NCTX}_csc${CSC}_ctp${CTP}_fp${FP}/seed${SEED}
if [ -d "$DIR" ]; then
echo "Results are available in ${DIR}. Skip this job"
else
echo "Run this job and save the output to ${DIR}"
python upl_train.py \
--root ${DATA} \
--seed ${SEED} \
--trainer ${TRAINER} \
--dataset-config-file configs/datasets/${DATASET}.yaml \
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
--output-dir ${DIR} \
--num-fp ${FP} \
TRAINER.UPLTrainer.N_CTX ${NCTX} \
TRAINER.UPLTrainer.CSC ${CSC} \
TRAINER.UPLTrainer.CLASS_TOKEN_POSITION ${CTP} \
DATASET.NUM_SHOTS ${SHOTS} \
DATASET.CLASS_EQULE ${CLASS_EQULE}
fi
done