if __name__ == '__main__': MODE = 10 LATENT_DIM = 100 IMAGE_SIZE = 64 DATASET_LEN = 20000 PRELOAD_LEN = 20000 EPOCHS = 50000 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_cfg = SamplerConfig( name='Onehot', out_shape=PRELOAD_LEN, latent_dim=LATENT_DIM, random_sampling=False ) goptim_cfg = OptimConfig('Adam', lr=0.0002) doptim_cfg = OptimConfig('Adam', lr=0.0002) dataset_cfg = DatasetConfig('CelebA', dataset_len=DATASET_LEN, image_size=IMAGE_SIZE, preload_len=PRELOAD_LEN) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True) gen_cfg = ModelConfig( 'EDCG', input_size=LATENT_DIM, hidden_size=128, output_size=3, data_num=PRELOAD_LEN, out_64=IMAGE_SIZE == 64 ) dis_cfg = ModelConfig('DCD', input_size=3, hidden_size=64, output_size=1, out_64=IMAGE_SIZE == 64)
save_image(img, os.path.join(logger.img_dir, 'gen_{0:05d}.jpg'.format(postfix))) if __name__ == '__main__': MODE = 10 LATENT_DIM = 100 IMAGE_SIZE = 32 DATASET_LEN = 20000 EPOCHS = 30000 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_cfg = SamplerConfig( name='Onehot', out_shape=DATASET_LEN, latent_dim=LATENT_DIM ) goptim_cfg = OptimConfig('Adam', lr=1e-3) doptim_cfg = OptimConfig('Adam', lr=1e-3) dataset_cfg = DatasetConfig('MNIST', train=True, stack=False, along_width=False, size=32) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True) gen_cfg = ModelConfig('EDCG', input_size=LATENT_DIM, hidden_size=128, output_size=1, data_num=DATASET_LEN) dis_cfg = ModelConfig('DCD', input_size=1, hidden_size=128, output_size=1) train_data_cfg = DatasetConfig('MNIST', stack=False, train=True, along_width=False) test_data_cfg = DatasetConfig('MNIST', stack=False, train=False, along_width=False) train_loader = LoaderConfig('naive', batch_size=128, shuffle=True)
os.path.join(logger.img_dir, 'sampler_modes_{0:05d}.jpg'.format(postfix))) plt.close() if __name__ == '__main__': dataset_len = 2000 mode = 20 latent_dim = 10 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_cfg = SamplerConfig( name='Onehot', out_shape=dataset_len, ) goptim_cfg = OptimConfig('Adam', lr=1e-3) doptim_cfg = OptimConfig('Adam', lr=1e-3) dataset_cfg = DatasetConfig('Spiral', mode=mode, sig=1, num_per_mode=dataset_len // mode, return_idx=True) # dataset_cfg = DatasetConfig('GMM', mode=mode, sig=1, num_per_mode=dataset_len // mode, return_idx=True) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True) gen_cfg = ModelConfig('MLG', input_size=latent_dim,
os.path.join(logger.img_dir, 'embed_{0:05d}.jpg'.format(postfix))) plt.close() if __name__ == '__main__': DATASET_LEN = 2000 MODE = 20 LATENT_DIM = 10 GAN_EPOCHS = 40000 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_cfg = SamplerConfig( name='Onehot', out_shape=DATASET_LEN, ) goptim_cfg = OptimConfig('Adam', lr=1e-3) doptim_cfg = OptimConfig('Adam', lr=1e-3) dataset_cfg = DatasetConfig('Spiral', mode=MODE, sig=1, num_per_mode=DATASET_LEN // MODE, return_idx=True) # dataset_cfg = DatasetConfig('GMM', mode=mode, sig=1, num_per_mode=dataset_len // mode, return_idx=True) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True) gen_cfg = ModelConfig('EMLG', input_size=LATENT_DIM,
plt.scatter(self.dataset.data[:, 0], self.dataset.data[:, 1], s=1, alpha=0.3) plt.savefig(os.path.join(logger.img_dir, 'scatter_gen_{}.jpg'.format(iter_num))) plt.close() if __name__ == '__main__': dataset_len = 2000 mode = 20 latent_dim = 10 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_cfg = SamplerConfig( name='Gaussian', out_shape=latent_dim, ) goptim_cfg = OptimConfig('Adam', lr=1e-3) doptim_cfg = OptimConfig('Adam', lr=1e-3) dataset_cfg = DatasetConfig('Spiral', mode=mode, sig=1, num_per_mode=dataset_len // mode) # dataset_cfg = DatasetConfig('GMM', mode=mode, sig=1, num_per_mode=dataset_len // mode) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True) gen_cfg = ModelConfig('MLG', input_size=latent_dim, hidden_size=32, output_size=2) dis_cfg = ModelConfig('MLD', input_size=2, hidden_size=32, output_size=1) gan_cfg = GanConfig( name='Vanilla', gen_cfg=gen_cfg, dis_cfg=dis_cfg, gen_step=1, dis_step=1, gan_epoch=15000, loader_cfg=loader_cfg,
if __name__ == '__main__': dataset_len = 2000 mode = 10 latent_dim = 10 device = 'cuda' gloss_cfg = LossConfig('BCE') dloss_cfg = LossConfig('BCE') sampler_loss_cfg = LossConfig('MSE') sampler_optim_cfg = OptimConfig('Adam', lr=0.001) sampler_cfg = SamplerConfig( name='Learning', out_shape=latent_dim, data_num=dataset_len, batch_size=2000, epoch=50, alpha=0, loss_cfg=sampler_loss_cfg, optim_cfg=sampler_optim_cfg, ) goptim_cfg = OptimConfig('Adam', lr=1e-3) doptim_cfg = OptimConfig('Adam', lr=1e-3) # dataset_cfg = DatasetConfig('Spiral', mode=mode, sig=1, num_per_mode=dataset_len // mode) dataset_cfg = DatasetConfig('GMM', mode=mode, sig=1, num_per_mode=dataset_len // mode) loader_cfg = LoaderConfig('naive', batch_size=128, shuffle=True)