-
Notifications
You must be signed in to change notification settings - Fork 2
/
02_start_test_seed.sh
executable file
·212 lines (184 loc) · 7.32 KB
/
02_start_test_seed.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/bash
export PYTHONPATH="${PWD}"
# 1. Input args
SD_PATH=$1 # /Your/Path/To/sd-v1-4-full-ema.ckpt
PROMPT_FILE=$2 # /Your/Path/To/Prompt_File.txt, e.g. ./infer_images/example_prompt.txt
PROJECT_FOLDER=$3 # project folder name under ./logs/, e.g. training2023-06-20T14-58-59_celebbasis
INTERPOLATION_ARGS=$4
LORA_FINETUNED=${5: False}
N_SAMPLES=${6:-4} # n_samples per text (equals to batch_size), default: 8
TEST_STEP=${7:-149999} # the step of saved weights, default: 799
LORA_SCALE=${8:-0.1}
LOGS_DIR=${9:-"./logs"}
# ------------------------------------------------------
# 2. Edit or modify the following settings as you need
step_list=(${TEST_STEP}) # default: (799), e.g. (99 199 299 399)
eval_id1_list=(0) # the id of the 1st person, e.g. (0 1 2 3 4)
eval_id2_list=(0) # the id of the 2nd person, e.g. (0 1 2 3 4)
# ------------------------------------------------------
# Usage Example:
# ./start_test.sh "./weights/sd-v1-4-full-ema.ckpt" "./infer_images/example_prompt.txt" "training2023-06-21T16-40-29_celebbasis"
#################### BEGIN #######################
project_folder="${PROJECT_FOLDER}"
project=${project_folder%_celebbasis}
cfg_file="${LOGS_DIR}/${project_folder}/configs/${project}-project.yaml"
echo "$cfg_file"
for (( i = 0 ; i < ${#eval_id1_list[@]} ; i++ )) do
eval_id1=${eval_id1_list[$i]}
eval_id2=${eval_id2_list[$i]}
for step_id in "${step_list[@]}"; do
echo embeddings_gs-"$step_id".pt
python scripts/stable_txt2img_testing_seed.py --ddim_eta 0.0 \
--n_samples "${N_SAMPLES}" \
--n_iter 1 \
--scale 5.0 \
--ddim_steps 50 \
--embedding_path "${LOGS_DIR}"/"$project_folder"/checkpoints/embeddings_gs-"$step_id".pt \
--ckpt "${SD_PATH}" \
--from-file "${PROMPT_FILE}" \
--outdir outputs/"$project_folder" \
--config "$cfg_file" \
--eval_id1 "${eval_id1}" \
--eval_id2 "${eval_id2}" \
--img_suffix "${eval_id1}_${eval_id2}_${step_id}" \
--seed 42 \
--interpolate_ids "${INTERPOLATION_ARGS}" \
--eval_dataset "ffhq" \
--lora_finetuned "${LORA_FINETUNED}" \
--lora_scale "${LORA_SCALE}"
done
done
#################### END #######################
#prompt_list=(
#"Elon Musk talks with Mr. Bean"
#"Mr. Bean talks with Elon Musk"
#"Mr. Bean shakes hands with Anne Hathaway"
#"Elon Musk talks with Anne Hathaway"
#"sks and ata sit on the sofa "
#"sks is talking with \`"
#"a man whose face is sks is sitting in front of another man whose face is ks"
#"a man whose face is sks is talking with another man whose face is \`"
#"a man whose face is sks is talking to another man whose face is *"
#"a man whose face is sks is talking to a woman whose face is *"
#"a man whose face is sks is talking to a woman whose face is Anne Hathaway"
#"a man whose face is * is talking to a man whose face is Mr. Bean"
#"sks shakes hands with Mr. Bean"
#"* talks with Anne Hathaway"
#"* shakes hands with Anne Hathaway"
#"Anne Hathaway shakes hands with *"
#"sks shakes hands with *"
#"* shakes hands with sks"
#"ks and sks are playing football"
#"sks and ks are playing football, ks and sks are playing football"
#)
prompt_list=(
#"a photo of sks face"
#"sks is playing basketball"
#"a man having sks face is playing guitar"
#"a man having sks face is playing skateboard"
#"a man having sks face is eating bread in front of the Eiffel Tower"
#"sks shakes hands with Elon Musk"
##"Elon Musk talks with sks"
#"Anne Hathaway talks to sks"
##"sks talks with Anne Hathaway"
#"a man having sks face shakes hands with another person having ks face"
#"a man having ks face shakes hands with another person having sks face"
# **** ID Embedding ****
"a photo of sks person"
#"sks person is playing basketball"
#"a sks person is playing guitar"
#"a sks person is playing skateboard"
#"a sks person is eating bread in front of the Eiffel Tower"
#"sks person shakes hands with Elon Musk"
##"Elon Musk talks with sks"
#"Anne Hathaway talks to sks person"
##"sks talks with Anne Hathaway"
#"a sks person shakes hands with a ks person"
#"a ks person shakes hands with a sks person"
# **** END ****
# ***** TWO CELEBS *****
##"a photo of Elon Musk" # [49406,320,1125,539,20406,19063,49407]
##"a photo of Anne Hathaway" # [49406,320,1125,539,4083,31801,49407]
#"a photo of ata tre"
#"ata tre is playing basketball"
#"ata tre is playing guitar"
#"ata tre is playing skateboard"
#"ata tre is eating bread in front of the Eiffel Tower"
#"ata tre talks with Barack Obama"
#"ata tre shakes hands with Robert Downey"
#
#"a photo of sks ks"
#"sks ks is playing basketball"
#"sks ks is playing guitar"
#"sks ks is playing skateboard"
#"sks ks is eating bread in front of the Eiffel Tower"
#"sks ks talks with Anne Hathaway"
#"sks ks shakes hands with Elon Musk"
#
#"ata tre shakes hands with sks ks"
#"sks ks talks to ata tre"
##"Elon Musk shakes hands with Steve Jobs"
##"ata tre shakes hands with Steve Jobs" # Steve:3803, Jobs:3735
##"Elon Musk shakes hands with Robert Downey"
##"ata tre shakes hands with Robert Downey" # Robert:3929, Downey:29429
##"Elon Musk shakes hands with Barack Obama"
##"ata tre shakes hands with Barack Obama" # Barack:22481, Obama:4276
# ***** TWO CELEBS END *****
# ***** MULTI CELEBS *****
#"Michael Jordan"
#"Oprah Winfrey"
# ***** MULTI CELEBS END *****
# ***** WORDS INTERPOLATION *****
#"a photo of Tom Cruise"
#"a picture of Tom Cruise"
# ***** WORDS INTERPOLATION END *****
#"a man with sks face talks to another man with ks face"
#"sks and ks sit on a sofa"
#"ks is talking with ata"
#"ata is talking with tre"
#"tre is talking with ry"
#"ry is talking with bop"
#"bop shakes hands with rn"
#"rn shakes hands with &"
#"& shakes hands with *"
#"* shakes hands with \`"
)
#for step_id in "${prompt_list[@]}"; do
# echo "$step_id"
# python scripts/stable_txt2img.py --ddim_eta 0.0 \
# --n_samples 8 \
# --n_iter 1 \
# --scale 10.0 \
# --ddim_steps 50 \
# --embedding_path logs/training2023-03-29T11-19-46_textualinversion/checkpoints/embeddings_gs-49999.pt \
# --ckpt ./weights/sd-v1-4-full-ema.ckpt \
# --prompt "$step_id"
#done
#python scripts/stable_txt2img.py --ddim_eta 0.0 \
# --n_samples 8 \
# --n_iter 1 \
# --scale 10.0 \
# --ddim_steps 50 \
# --embedding_path logs/training2023-04-04T17-14-14_textualinversion/checkpoints/embeddings_gs-9999.pt \
# --ckpt ./weights/sd-v1-4-full-ema.ckpt \
# --from-file ./infer_images/personalize.txt
#file_list=("000" "001" "002" "003" "004" "005" "006" "007" "008" "009" "010" "011" "012")
#for a_prompt in "${file_list[@]}"; do
# echo ./infer_images/wiki_names_"$a_prompt".txt
# python scripts/stable_txt2img.py --ddim_eta 0.0 \
# --n_samples 8 \
# --n_iter 1 \
# --scale 10.0 \
# --ddim_steps 50 \
# --embedding_path logs/training2023-04-17T22-27-34_textualinversion/checkpoints/embeddings_gs-7999.pt \
# --ckpt ./weights/sd-v1-4-full-ema.ckpt \
# --from-file ./infer_images/wiki_names_"$a_prompt".txt
#done
#python scripts/stable_txt2img.py --ddim_eta 0.0 \
# --n_samples 8 \
# --n_iter 1 \
# --scale 10.0 \
# --ddim_steps 50 \
# --embedding_path logs/training2023-03-30T21-21-35_textualinversion/checkpoints/embeddings_gs-2999.pt \
# --ckpt ./weights/sd-v1-4-full-ema.ckpt \
# --from-file ./infer_images/interpolation.txt