-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain.sh
executable file
·78 lines (65 loc) · 1.68 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
export CUDA_DEVICE_ORDER=PCI_BUS_ID
export CUDA_VISIBLE_DEVICES=0
export PYTHONPATH=${PYTHONPATH}:$(pwd)/../..
seed_number=777
dataset='HAM10000' # HAM10000, BCCD, DTR
use_img_norm='false'
use_txt_norm='false'
use_residual='false'
func='our_main'
lr=0.0005
clip_model='ViT-L/14'
cfn="our_selection"
batch_size=256 # 256
concept_path="./gpt_concepts/${dataset}.json"
concept2type='false'
pearson_weight=0.9
if [ ${dataset} = "HAM10000" ]
then
num_concept=70 # 7*50 HAM
epoch=300 # 300
num_layers=2
elif [ ${dataset} = "BCCD" ]
then
num_concept=40 # 4*50 BCCD
epoch=100 # 100
num_layers=1
elif [ ${dataset} = "DTR" ]
then
num_concept=250 # 5*50 DTR
epoch=300 # 300
num_layers=1
fi
if [ ${num_layers} = 1 ]
then
name_num_layers='one' # 256
elif [ ${num_layers} = 2 ]
then
name_num_layers='two' # 256
elif [ ${num_layers} = 4 ]
then
name_num_layers='four' # 256
fi
directory="${dataset}testUtility"
echo "${cfn} ${seed_number} ${func} ${num_concept} ${directory}"
python main.py --cfg cfg/${dataset}/${dataset}_allshot_fac.py \
--work-dir exp/${dataset}/${directory} \
--func ${func} \
--cfg-options "data_root='exp/${dataset}/${directory}'" \
"max_epochs=${epoch}" \
"concept_select_fn=${cfn}" \
"seed=${seed_number}" \
"num_concept=${num_concept}" \
"lr=${lr}" \
"concept_path='${concept_path}'" \
"concept2type='${concept2type}'" \
"clip_model='${clip_model}'" \
"use_img_norm='${use_img_norm}'" \
"use_txt_norm='${use_txt_norm}'" \
"use_residual='${use_residual}'" \
"bs=${batch_size}" \
"num_layers=${num_layers}" \
"pearson_weight=${pearson_weight}" \
"freeze_backbone=true"
echo "${cfn} ${seed_number} ${func} ${num_concept} finished"