-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_unittest.py
292 lines (265 loc) · 20.7 KB
/
test_unittest.py
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# test_my_unittest
from hydra import initialize, compose
# 1. initialize will add config_path the config search path within the context
# 2. The module with your configs should be importable.
# it needs to have a __init__.py (can be empty).
# 3. THe config path is relative to the file calling initialize (this file)
from main import run_without_decorator
def test_with_initialize() -> None:
common_command = ["hydra.runtime.output_dir='./'", "debug=1"]
with initialize(version_base=None, config_path="config"):
if False:
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle sg.params.condition_method=cluster_lookup dynamic=unet_fast dynamic.params.model_channels=128 data.params.batch_size=128 sg.params.cond_dim=100 data.h5_file=sg_data/cluster/v3_in32p_cluster10000_iter30minp200_nns-1_dino_vits16_2022-08-12T20_7383c8d.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=20 data.fid_every_n_epoch=4 name=v1.6.2_dino_vits16_cluster10k_in32p_unetfast_ep20_rerun debug=0".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False:#5k
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle sg.params.condition_method=cluster dynamic=unet_fast dynamic.params.model_channels=128 data.params.batch_size=128 sg.params.cond_dim=50000 data.h5_file=sg_data/cluster/v4_in32p_cluster50000_iter30minp200_nns-1_dino_vits16_grey0_2022-11-09T18_b4b1257.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=20 data.fid_every_n_epoch=4 debug=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False:#corruption
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle sg.params.condition_method=cluster dynamic=unet_fast dynamic.params.model_channels=128 data.params.batch_size=128 data.corruption=0.5 sg.params.cond_dim=5000 data.h5_file=sg_data/cluster/v3_in32p_cluster5000_iter30minp200_nns-1_dino_vits16_2022-08-20T19_2a4fe12.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=20 data.fid_every_n_epoch=4 debug=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif True:#subgroup
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle sg.params.condition_method=label dynamic=unet_fast dynamic.params.model_channels=128 data.params.batch_size=128 data.subgroup=5 sg.params.cond_dim=5000 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=20 data.fid_every_n_epoch=4 debug=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False:
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=coco64 sg.params.condition_method=clusterlayout condition.clusterlayout.how=lost condition.clusterlayout.layout_dim=1 dynamic=unetca_fast_s64 dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 dynamic.params.model_channels=128 data.params.batch_size=80 condition.cluster.feat_cluster_k=100 sg.params.cond_dim=100 data.h5_file='~/data/sg_data/cluster/v3_coco64_cluster100_iter30minp200_nns-1_dino_vits16_2022-08-11T20_311135d.h5' data.lost_file=dataset/data_files/lost/LOST-vit_small16_k_COCO20k_train/lost_k100.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=400 data.fid_every_n_epoch=40 name=v1.6.2_dino_vits16_cluster100layout_coco64_unetca_fast_s64_ep400 debug=0 train=0 resume_from='outputs/v1.6.2_dino_vits16_cluster100layout_coco64_unetca_fast_s64_ep400/16-08-2022/21-06-46/ckpts/last.ckpt' train=0 name='analysis_coco' +vis.voc_vis_samelayout=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False:
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides=" data=voc64 sg.params.condition_method=attr dynamic=unetca_fast dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 sg.params.cond_dim=21 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=40 name=v1.6.2_label_voc64_unetca_fast data.params.batch_size=80 debug=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # vis_voc_lost
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides=" data=voc64 sg.params.condition_method=clusterlayout condition.clusterlayout.how=lost condition.clusterlayout.layout_dim=1 dynamic=unetca_fast_s64 dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 dynamic.params.model_channels=128 condition.cluster.feat_cluster_k=100 sg.params.cond_dim=100 data.h5_file='data/sg_data/cluster/v3_voc64_cluster100_iter30minp200_nns-1_dino_vits16_2022-08-11T20_311135d.h5' data.lost_file=dataset/data_files/lost/LOST-vit_small16_k_voc12aug/lost_k100.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=40 name=vis_voc_lost debug=0 resume_from='outputs/v1.6.2_dino_vits16_cluster100layout_voc64_unetca_fast_s64_ep800/16-08-2022/21-05-43/ckpts/epoch\=000640.ckpt' train=0 data.params.batch_size=10 +vis.voc_lost=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # vis_voc_stego
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides=" data=voc64 sg.params.condition_method=clusterlayout condition.clusterlayout.how=stego condition.clusterlayout.layout_dim=21 dynamic=unetca_fast_s64 dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 dynamic.params.model_channels=128 data.params.batch_size=80 condition.cluster.feat_cluster_k=100 sg.params.cond_dim=100 data.h5_file=data/sg_data/cluster/v3_voc64_cluster100_iter30minp200_nns-1_dino_vits16_2022-08-11T20_311135d.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=40 name=vis_voc_stego resume_from='outputs/v1.6.2_dino_vits16_cluster100layout_stego_voc64_unetca_fast_s64_ep800/23-08-2022/16-54-40/ckpts/epoch\=000720.ckpt' train=0 data.params.batch_size=10 +vis.voc_stego=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # vis_voc_stego_layout
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides=" data=voc64 sg.params.condition_method=layout condition.layout.how=stego condition.layout.layout_dim=21 dynamic=unetca_fast_s64 dynamic.params.cond_token_num=0 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=0 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=40".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # stegoclusterlayout
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=cocostuff64 sg.params.condition_method=stegoclusterlayout condition.stegoclusterlayout.how=stego condition.stegoclusterlayout.layout_dim=27 dynamic=unetca_fast dynamic.params.cond_token_num=1 sg.params.cond_dim=27 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=400 data.fid_every_n_epoch=40 name=v1.6.2_dino_vits16_stegoclusterlayout_cocostuff64_unetca_fast_ep400".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # in32, label
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle dynamic=unet_fast sg.params.condition_method=label sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 dynamic.params.model_channels=128 sg.params.cond_dim=1000 data.params.batch_size=128 name=v1.6.2_label_in32p_unet_fast_ep100 debug=0 data.trainer.max_epochs=100 data.fid_every_n_epoch=10 debug=0 data.params.batch_size=200 resume_from=outputs/v1.6.2_label_in32p_unet_fast_ep100/15-09-2022/19-05-29/ckpts/last.ckpt train=0 +vis.samecondition=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # in64,label
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in64_pickle dynamic=unet_fast sg.params.condition_method=label sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 dynamic.params.model_channels=128 sg.params.cond_dim=1000 name=v1.6.2_label_in64p_unet_fast_ep100_vis data.trainer.max_epochs=100 data.fid_every_n_epoch=10 debug=0 data.params.batch_size=100 resume_from=outputs/v1.6.2_label_in64p_unet_fast_ep100/15-09-2022/19-05-29/ckpts/last.ckpt +vis.samecondition=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # VOC,lost
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=voc64 sg.params.condition_method=clusterlayout condition.clusterlayout.how=lost condition.clusterlayout.layout_dim=1 dynamic=unetca_fast dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=100 data.h5_file=sg_data/cluster/v3_voc64_cluster100_iter30minp200_nns-1_dino_vits16_2022-08-11T20_311135d.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=80 name=v1.6.2_dino_vits16_cluster100layout_voc64_unetca_fast_ep800 debug=0 resume_from='outputs/v1.6.2_dino_vits16_cluster100layout_voc64_unetca_fast_ep800/10-09-2022/00-26-28/ckpts/last.ckpt' train=0 +vis.lost_chainvis=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # VOC,attr
# +exp.ablate_scale=1 +exp.ablate_scale_list=[4,0.0,0.5,1,1.5,2,2.5,3,3.5]
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=voc64 sg.params.condition_method=attr dynamic=unetca_fast dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 sg.params.cond_dim=21 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=80 name=v1.6.2_label_voc64_unetca_fast_ep800_vis data.params.batch_size=80 debug=0 resume_from='outputs/v1.6.2_label_voc64_unetca_fast_ep800/10-09-2022/00-15-33/ckpts/last.ckpt' train=0 +vis.samecondition=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # cocosstuff64, attr-guidance, vis.diff_z_same_stego=1
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=cocostuff64 sg.params.condition_method=attr dynamic=unetca_fast dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 sg.params.cond_dim=27 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=4000 data.fid_every_n_epoch=40 name=v1.6.2_attr27_cocostuff64_unetca_fast_vis data.params.batch_size=128 debug=0 train=0 resume_from='outputs/v1.6.2_attr27_cocostuff64_unetca_fast/05-09-2022/01-00-46/ckpts/last.ckpt' train=0 +vis.samecondition=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # cocosstuff64, stego, vis.stego_chainvis=1
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=cocostuff64 sg.params.condition_method=layout condition.layout.how=stego condition.layout.layout_dim=27 dynamic=unetca_fast dynamic.params.cond_token_num=0 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=0 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=400 data.fid_every_n_epoch=40 name=v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400_vis resume_from=outputs/v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400/03-09-2022/21-59-52/ckpts/last.ckpt train=0 +vis.stego_chainvis=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # cocosstuff64, stego, vis.diff_z_same_stego=1
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=cocostuff64 sg.params.condition_method=layout condition.layout.how=stego condition.layout.layout_dim=27 dynamic=unetca_fast dynamic.params.cond_token_num=0 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=0 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=400 data.fid_every_n_epoch=40 name=v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400_vis resume_from=outputs/v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400/03-09-2022/21-59-52/ckpts/last.ckpt train=0 +vis.diff_z_same_stego=1 ".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # vis, in32, vits10k,
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in32_pickle sg.params.condition_method=cluster dynamic=unet_fast dynamic.params.model_channels=128 data.params.batch_size=320 sg.params.cond_dim=10000 data.h5_file=sg_data/cluster/v3_in32p_cluster10000_iter30minp200_nns-1_dino_vitb16_2022-08-17T21_7b919c8.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=100 data.fid_every_n_epoch=10 name=v1.6.2_dino_vitb16_cluster10k_in32p_unetfast_ep100_4gpu_vis debug=0 train=0 resume_from='outputs/v1.6.2_dino_vitb16_cluster10k_in32p_unetfast_ep100_4gpu/21-08-2022/01-16-31/ckpts/last.ckpt' seed=66 +vis.samecondition=1".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # vis, in64, vitb10k,
# +vis.interp=1 +vis.interp_c.samples=16 +vis.interp_c.n=9
# +vis.chainvis=1 +vis.chainvis_c.samples=7 +vis.chainvis_c.timestep=7
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=in64_pickle sg.params.condition_method=cluster dynamic=unet_fast dynamic.params.model_channels=128 sg.params.cond_dim=10000 data.h5_file=sg_data/cluster/v3_in64p_cluster10000_iter30minp200_nns-1_dino_vitb16_2022-08-20T23_4e15934.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=100 data.fid_every_n_epoch=10 debug=0 name=v1.6.2_dino_vitb16_cluster10k_in64p_unetfast_ep100_4gpu_inferencelast_vis resume_from=outputs/v1.6.2_dino_vitb16_cluster10k_in64p_unetfast_ep100_4gpu/04-09-2022/10-57-50/ckpts/last.ckpt data.params.batch_size=128 train=0 seed=66 +vis.interp=1 +vis.interp_c.samples=16 +vis.interp_c.n=9".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # VIS, VOC, LOST
# exp.cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4] data.test_fid_num=500 name=voc_condscale_lost
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=voc64 sg.params.condition_method=clusterlayout condition.clusterlayout.how=lost condition.clusterlayout.layout_dim=1 dynamic=unetca_fast dynamic.params.cond_token_num=1 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=100 data.h5_file=sg_data/cluster/v3_voc64_cluster100_iter30minp200_nns-1_dino_vits16_2022-08-11T20_311135d.h5 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=80 name=v1.6.2_dino_vits16_cluster100layout_voc64_unetca_fast_ep800 debug=0 resume_from='outputs/v1.6.2_dino_vits16_cluster100layout_voc64_unetca_fast_ep800/10-09-2022/00-26-28/ckpts/last.ckpt' train=0 exp.cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4] data.test_fid_num=500 name=voc_condscale_lost_f".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif False: # VIS, VOC, stego
# +vis.diff_z_same_stego=1
# +vis.condscale=1 +vis.condscale_c.samples=8
# exp.cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4] data.test_fid_num=500 name=voc_condscale_lost
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=voc64 sg.params.condition_method=stegoclusterlayout condition.stegoclusterlayout.how=stego condition.stegoclusterlayout.layout_dim=21 dynamic=unetca_fast dynamic.params.cond_token_num=1 sg.params.cond_dim=21 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=800 data.fid_every_n_epoch=80 name=v1.6.2_dino_vits16_stegoclusterlayout_voc64_unetca_fast_ep800 debug=0 resume_from='outputs/v1.6.2_dino_vits16_stegoclusterlayout_voc64_unetca_fast_ep800/19-09-2022/18-49-07/ckpts/last.ckpt' exp.cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4] name=voc_condscale_stegoclusterlayout train=0 data.test_fid_num=500".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
elif True: # VIS, cocostuff, stego
# +vis.diff_z_same_stego=1
# +vis.condscale=1 +vis.condscale_c.samples=8
# exp.cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4] data.test_fid_num=500 name=voc_condscale_lost
cfg = compose(
config_name="config_base",
return_hydra_config=True,
overrides="data=cocostuff64 sg.params.condition_method=layout condition.layout.how=stego condition.layout.layout_dim=27 dynamic=unetca_fast dynamic.params.cond_token_num=0 dynamic.params.context_dim=32 data.params.batch_size=80 sg.params.cond_dim=0 sg.params.cond_drop_prob=0.1 sg.params.cond_scale=2 data.trainer.max_epochs=400 data.fid_every_n_epoch=40 name=v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400_vis resume_from=outputs/v1.6.2_dino_vits16_stego_cocostuff64_unetca_fast_ep400/03-09-2022/21-59-52/ckpts/last.ckpt train=0 +cond_scale=0 exp.ablate_scale=1 exp.ablate_scale_list=[0,1,2,3,0.5,1.5,2.5,3.5,4]".replace(
"'", ""
)
.replace("~/", "")
.split()
+ common_command,
)
print(cfg)
run_without_decorator(cfg, run_unittest=True)
test_with_initialize()