@@ -0,0 +1,1409 @@
+from argparse import ArgumentParser%0Aimport os%0Aimport sys%0A%0Afrom pylearn2.utils import serial%0A%0Afrom adversarial import sampler%0Afrom adversarial.util import make_image_from_sample%0A%0A%0Aparser = ArgumentParser(description=('Sample a large number of images from a cGAN and '%0A                                     'save to a directory.'))%0Aparser.add_argument('-s', '--conditional-sampler', default='random',%0A                    choices=sampler.conditional_samplers.values(),%0A                    type=lambda k: sampler.conditional_samplers%5Bk%5D)%0Aparser.add_argument('-n', type=int, default=1000, help='Number of images to generate')%0Aparser.add_argument('model_path')%0Aparser.add_argument('output_directory')%0Aargs = parser.parse_args()%0A%0A%0Aif os.path.exists(args.output_directory):%0A    print 'Warning: output directory %25s exists' %25 args.output_directory%0A%0A    if os.path.isfile(args.output_directory):%0A        raise ValueError(%22Provided output directory %25s is a file%22 %25 args.output_directory)%0Aelse:%0A    os.mkdirs(args.output_directory)%0A%0A%0Asamples = sampler.get_conditional_topo_samples(args.model_path, args.n, 1,%0A                                               args.conditional_sampler)%0Afor i, sample in enumerate(samples):%0A    img = make_image_from_sample(sample)%0A    path = os.path.join(args.output_directory, '%2504i.png' %25 i)%0A    img.save(path)%0A%0Aprint %3E%3E sys.stderr, %22Saved %25i images to %25s.%22 %25 (args.n, args.output_directory)%0A

Add large-scale sampling code