File size: 4,085 Bytes
d643072 |
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
#!/bin/bash
output_dir=output
# ============ start of custom code block ==========
config_file=''
model_paths_file=''
if [ -n "$1" ]; then
config_file=$1
fi
if [ -n "$2" ]; then
model_paths_file=$2
fi
# ============ end of custom code block ===========
default_step=20
default_bs=50 # 1
default_sample_nums=30000
default_sampling_algo="flow_dpm-solver"
json_file="data/test/PG-eval-data/MJHQ-30K/meta_data.json"
default_add_label=''
default_dataset='MJHQ-30K'
default_img_size=512 # 1024
default_fid_suffix_label='30K_bs50_Flow_DPM20' # suffix of the line chart on wandb
default_log_fid=false
default_log_clip_score=false
# 👇No need to change the code below
job_name=$(basename $(dirname $(dirname "$model_paths_file")))
for arg in "$@"
do
case $arg in
--step=*)
step="${arg#*=}"
shift
;;
--bs=*)
bs="${arg#*=}"
shift
;;
--sample_nums=*)
sample_nums="${arg#*=}"
shift
;;
--sampling_algo=*)
sampling_algo="${arg#*=}"
shift
;;
--dataset=*)
dataset="${arg#*=}"
shift
;;
--img_size=*)
img_size="${arg#*=}"
shift
;;
--cfg_scale=*)
cfg_scale="${arg#*=}"
shift
;;
--fid_suffix_label=*)
fid_suffix_label="${arg#*=}"
shift
;;
--add_label=*)
add_label="${arg#*=}"
shift
;;
--log_fid=*)
log_fid="${arg#*=}"
shift
;;
--log_clip_score=*)
log_clip_score="${arg#*=}"
shift
;;
--auto_ckpt=*)
auto_ckpt="${arg#*=}"
shift
;;
--auto_ckpt_interval=*)
auto_ckpt_interval="${arg#*=}"
shift
;;
--inference=*)
inference="${arg#*=}"
shift
;;
--fid=*)
fid="${arg#*=}"
shift
;;
--clipscore=*)
clipscore="${arg#*=}"
shift
;;
--tracker_pattern=*)
tracker_pattern="${arg#*=}"
shift
;;
--ablation_key=*)
ablation_key="${arg#*=}"
shift
;;
--ablation_selections=*)
ablation_selections="${arg#*=}"
shift
;;
*)
;;
esac
done
inference=${inference:-true} # if run model inference
fid=${fid:-true} # if compute fid
clipscore=${clipscore:-true} # if compute clip-score
step=${step:-$default_step}
bs=${bs:-$default_bs}
dataset=${dataset:-$default_dataset}
cfg_scale=${cfg_scale:-4.5}
sample_nums=${sample_nums:-$default_sample_nums}
sampling_algo=${sampling_algo:-$default_sampling_algo}
img_size=${img_size:-$default_img_size}
fid_suffix_label=${fid_suffix_label:-$default_fid_suffix_label}
add_label=${add_label:-$default_add_label}
ablation_key=${ablation_key:-''}
ablation_selections=${ablation_selections:-''}
tracker_pattern=${tracker_pattern:-"epoch_step"}
log_fid=${log_fid:-$default_log_fid}
log_clip_score=${log_clip_score:-$default_log_clip_score}
auto_ckpt=${auto_ckpt:-false} # if collect ckpt path automatically, use with the following one $auto_ckpt_interval
auto_ckpt_interval=${auto_ckpt_interval:-0} # 0:last step in one epoch; 1000: every 1000 steps
read -r -d '' cmd <<EOF
bash scripts/infer_metric_run_inference_metric.sh $config_file $model_paths_file \
--inference=$inference --fid=$fid --clipscore=$clipscore \
--step=$step --bs=$bs --sample_nums=$sample_nums --json_file=$json_file \
--exist_time_prefix=$exist_time_prefix --img_size=$img_size --cfg_scale=$cfg_scale \
--fid_suffix_label=$fid_suffix_label --add_label=$add_label --dataset=$dataset \
--log_fid=$log_fid --log_clip_score=$log_clip_score \
--output_dir=$output_dir --auto_ckpt=$auto_ckpt --sampling_algo=$sampling_algo \
--auto_ckpt_interval=$auto_ckpt_interval --tracker_pattern=$tracker_pattern \
--ablation_key=$ablation_key --ablation_selections="$ablation_selections"
EOF
echo $cmd '\n'
bash -c "${cmd}"
|