Xsmos commited on
Commit
3be1862
·
verified ·
1 Parent(s): b91c221
Files changed (3) hide show
  1. context_unet.py +1 -1
  2. diffusion.py +14 -5
  3. quantify_results.ipynb +0 -0
context_unet.py CHANGED
@@ -330,7 +330,7 @@ class ContextUnet(nn.Module):
330
  elif image_size == 128:
331
  channel_mult = (1, 1, 2, 3, 4)
332
  elif image_size == 64:
333
- channel_mult = (1, 1, 2, 2, 4, 4)#(1, 2, 3, 4)#(1, 2, 4, 6, 8)#(1, 2, 2, 4)#(1, 2, 8, 8, 8)#(1, 2, 4)#(1, 2, 2, 4)#(0.5,1,2,2,4,4)#(1, 1, 2, 2, 4, 4)#
334
  elif image_size == 32:
335
  channel_mult = (1, 2, 2, 4)
336
  elif image_size == 28:
 
330
  elif image_size == 128:
331
  channel_mult = (1, 1, 2, 3, 4)
332
  elif image_size == 64:
333
+ channel_mult = (1, 2, 2, 4, 8)#(1, 2, 3, 4)#(1, 2, 4, 6, 8)#(1, 2, 2, 4)#(1, 2, 8, 8, 8)#(1, 2, 4)#(1, 2, 2, 4)#(0.5,1,2,2,4,4)#(1, 1, 2, 2, 4, 4)#
334
  elif image_size == 32:
335
  channel_mult = (1, 2, 2, 4)
336
  elif image_size == 28:
diffusion.py CHANGED
@@ -241,7 +241,7 @@ class TrainConfig:
241
  stride = (2,2) if dim == 2 else (2,2,2)
242
  num_image = 1000#2000#20000#15000#7000#25600#3000#10000#1000#10000#5000#2560#800#2560
243
  batch_size = 50#1#2#50#20#2#100 # 10
244
- n_epoch = 20#5#4# 10#50#20#20#2#5#25 # 120
245
  HII_DIM = 64
246
  num_redshift = 64#512#128#64#512#256#256#64#512#128
247
  channel = 1
@@ -666,13 +666,13 @@ def generate_samples(rank, world_size, config, num_new_img_per_gpu, max_num_img_
666
 
667
  if __name__ == "__main__":
668
  world_size = torch.cuda.device_count()
669
- print(f" sampling, world_size = {world_size} ".center(100,'-'))
670
  # num_train_image_list = [1600,3200,6400,12800,25600]
671
  # num_train_image_list = [5000]
672
  num_new_img_per_gpu = 200
673
- max_num_img_per_gpu = 20
674
 
675
- params = torch.tensor([4.4, 131.341])
676
 
677
  # print("config = TrainConfig()")
678
  config = TrainConfig()
@@ -687,7 +687,16 @@ if __name__ == "__main__":
687
  manager = mp.Manager()
688
  return_dict = manager.dict()
689
 
690
- mp.spawn(generate_samples, args=(world_size, config, num_new_img_per_gpu, max_num_img_per_gpu, return_dict, params), nprocs=world_size, join=True)
 
 
 
 
 
 
 
 
 
691
 
692
  # print("---"*30)
693
  # print(f"device {torch.cuda.current_device()}, keys = {return_dict.keys()}")
 
241
  stride = (2,2) if dim == 2 else (2,2,2)
242
  num_image = 1000#2000#20000#15000#7000#25600#3000#10000#1000#10000#5000#2560#800#2560
243
  batch_size = 50#1#2#50#20#2#100 # 10
244
+ n_epoch = 30#5#4# 10#50#20#20#2#5#25 # 120
245
  HII_DIM = 64
246
  num_redshift = 64#512#128#64#512#256#256#64#512#128
247
  channel = 1
 
666
 
667
  if __name__ == "__main__":
668
  world_size = torch.cuda.device_count()
669
+ # print(f" sampling, world_size = {world_size} ".center(100,'-'))
670
  # num_train_image_list = [1600,3200,6400,12800,25600]
671
  # num_train_image_list = [5000]
672
  num_new_img_per_gpu = 200
673
+ max_num_img_per_gpu = 40
674
 
675
+ # params = torch.tensor([4.4, 131.341])
676
 
677
  # print("config = TrainConfig()")
678
  config = TrainConfig()
 
687
  manager = mp.Manager()
688
  return_dict = manager.dict()
689
 
690
+ params_pairs = [
691
+ (4.4, 131.341),
692
+ (5.6, 19.037),
693
+ (4.699, 30),
694
+ (5.477, 200),
695
+ (4.8, 131.341),
696
+ ]
697
+ for params in params_pairs:
698
+ print(f" sampling for {params}, world_size = {world_size} ".center(100,'-'))
699
+ mp.spawn(generate_samples, args=(world_size, config, num_new_img_per_gpu, max_num_img_per_gpu, return_dict, torch.tensor(params)), nprocs=world_size, join=True)
700
 
701
  # print("---"*30)
702
  # print(f"device {torch.cuda.current_device()}, keys = {return_dict.keys()}")
quantify_results.ipynb CHANGED
The diff for this file is too large to render. See raw diff