Mehdi Cherti commited on
Commit
023c7dd
1 Parent(s): 9e9d0ce

small fix and comments

Browse files
Files changed (1) hide show
  1. test_ddgan.py +18 -3
test_ddgan.py CHANGED
@@ -496,7 +496,7 @@ def sample_and_test(args):
496
  if args.guidance_scale:
497
  fake_sample = sample_from_model_classifier_free_guidance(pos_coeff, netG, args.num_timesteps, x_t_1,T, args, text_encoder, cond=cond, guidance_scale=args.guidance_scale)
498
  else:
499
- fake_sample = sample(generator=netG, x_init=x_init, cond=cond)
500
  fake_sample = to_range_0_1(fake_sample)
501
 
502
  if args.compute_fid:
@@ -602,6 +602,9 @@ if __name__ == '__main__':
602
  parser.add_argument('--name', type=str, default="", help="model config name")
603
  parser.add_argument('--batch-size', type=int, default=16)
604
  parser.add_argument('--seed', type=int, default=1024, help='seed used for initialization')
 
 
 
605
  parser.add_argument('--compute-fid', action='store_true', default=False,
606
  help='whether or not compute FID')
607
  parser.add_argument('--compute-clip-score', action='store_true', default=False,
@@ -609,16 +612,28 @@ if __name__ == '__main__':
609
  parser.add_argument('--compute-image-reward', action='store_true', default=False,
610
  help='whether or not compute CLIP score')
611
 
 
612
  parser.add_argument('--clip-model', type=str,default="ViT-L/14")
 
 
 
 
 
613
  parser.add_argument('--eval-name', type=str,default="")
 
 
614
  parser.add_argument('--epoch-id', type=int,default=-1)
 
 
615
  parser.add_argument('--guidance-scale', type=float,default=0)
616
  parser.add_argument('--dynamic-thresholding-quantile', type=float,default=0)
617
- parser.add_argument('--cond-text', type=str,default="a chair in the form of an avocado")
 
618
  parser.add_argument('--scale-factor-h', type=int,default=1)
619
  parser.add_argument('--scale-factor-w', type=int,default=1)
620
  parser.add_argument('--scale-method', type=str,default="convolutional")
621
- parser.add_argument('--nb-images-for-fid', type=int, default=0)
 
622
  args = parser.parse_args()
623
  sample_and_test(args)
624
 
 
496
  if args.guidance_scale:
497
  fake_sample = sample_from_model_classifier_free_guidance(pos_coeff, netG, args.num_timesteps, x_t_1,T, args, text_encoder, cond=cond, guidance_scale=args.guidance_scale)
498
  else:
499
+ fake_sample = sample(generator=netG, x_init=x_t_1, cond=cond)
500
  fake_sample = to_range_0_1(fake_sample)
501
 
502
  if args.compute_fid:
 
602
  parser.add_argument('--name', type=str, default="", help="model config name")
603
  parser.add_argument('--batch-size', type=int, default=16)
604
  parser.add_argument('--seed', type=int, default=1024, help='seed used for initialization')
605
+
606
+ # by default, we just generate samples and save them to samples.jpg
607
+ # for evaluation, one or several of the following should be set to True
608
  parser.add_argument('--compute-fid', action='store_true', default=False,
609
  help='whether or not compute FID')
610
  parser.add_argument('--compute-clip-score', action='store_true', default=False,
 
612
  parser.add_argument('--compute-image-reward', action='store_true', default=False,
613
  help='whether or not compute CLIP score')
614
 
615
+ # clip model for clip evaluation
616
  parser.add_argument('--clip-model', type=str,default="ViT-L/14")
617
+
618
+ # nb images to use for FID evaluation
619
+ parser.add_argument('--nb-images-for-fid', type=int, default=0)
620
+
621
+ # eval name to use when saving the evaluation results
622
  parser.add_argument('--eval-name', type=str,default="")
623
+
624
+ # epoch to use for evaluation, if -1, iterate over all epochs (for evaluation)
625
  parser.add_argument('--epoch-id', type=int,default=-1)
626
+
627
+
628
  parser.add_argument('--guidance-scale', type=float,default=0)
629
  parser.add_argument('--dynamic-thresholding-quantile', type=float,default=0)
630
+
631
+ # either a text, or a .txt file, where each line is a prompt
632
  parser.add_argument('--scale-factor-h', type=int,default=1)
633
  parser.add_argument('--scale-factor-w', type=int,default=1)
634
  parser.add_argument('--scale-method', type=str,default="convolutional")
635
+ parser.add_argument('--cond-text', type=str,default="a chair in the form of an avocado")
636
+
637
  args = parser.parse_args()
638
  sample_and_test(args)
639