-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_zoom.sh
executable file
·73 lines (55 loc) · 2.1 KB
/
run_zoom.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
set -e
seed=1557241
default_attr=Young
default_exp=ffhq
default_gpu=0
default_classifier=full
attr=${1:-${default_attr}}
echo $attr
exp=${2:-${default_exp}}
echo $exp
gpu=${3:-${default_gpu}}
echo $gpu
token=$4
echo $token
classifier=${5:-${default_classifier}}
echo $classifier
# outlogdir=./log/${exp}-$(date +%F)
# mkdir -m 777 -p $outlogdir
mode="single"
step=0.2
iteration=100
bound=30
# mode="multiple"
# step=0.1
# iteration=100
# bound=30
# tokens for CLIP loss
token='["an Old face", "a Young face"]'
echo ${attr}-${mode}-${classifier}-${step}-${iteration}-${seed}-${bound}.txt
if test -f "${outdir}/${attr}-${mode}-${classifier}-${step}-${iteration}-${seed}-${bound}.txt"; then
echo "log file exists."
read -p "Do you wish to overwrite log file? " yn
case $yn in
[Yy]* ) :;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
fi
# echo ${attr}-${mode}-${classifier}-${step}-${iteration}-${seed}-${bound}.txt
style_beta_or_channel=0.1
python zoom.py --target_model_path="pretrained/victim_models/resnet50_${attr}_train${classifier}" \
--seed=${seed} \
--clip_token="${token}"\
--attack_step_size=${step}\
--style_beta_or_channel=${style_beta_or_channel}\
--device="cuda:${gpu}" \
--attack_iter=${iteration} \
--attack_bound=${bound} \
--mode=${mode} \
--num_sample=1500 \
--clip_weight=0.005 \
--outdir=output/${exp}-$(date +%F)/${attr} \
--experiment=${exp}
# --experiment=${exp} > ${outlogdir}/${attr}-${mode}-${classifier}-${step}-${iteration}-${seed}-${bound}.txt
# python histogram.py -p "${outlogdir}/${attr}-${mode}-${classifier}-${step}-${iteration}-${bound}*"