def __init__(self, config, ckeck_point): self.config = config self.epochs = config.epochs self.model_type = config.model self.ckpt = ckeck_point self.tensorboard = config.tensorboard if self.tensorboard: self.summary_writer = SummaryWriter(self.ckpt.log_dir, 300) # set model, criterion, optimizer self.model = Model(config) summary(self.model, config_file=self.ckpt.config_file) # set criterion, optimizer self.criterion = Loss(config) self.optimizer = make_optimizer(config, self.model) # load ckpt, model, optimizer if (self.ckpt.exp_load is not None) or (not config.is_train): print("Loading model... ") self.load(self.ckpt) print(self.ckpt.last_epoch, self.ckpt.global_step)
def summary_text(text, l): return summary(text, l)
use_noise=args['--use_noise'], noise_sigma=float( args['--noise_sigma'])) video_discriminator = build_discriminator(args['--video_discriminator'], dim_categorical=dim_z_category, n_channels=n_channels, use_noise=args['--use_noise'], noise_sigma=float( args['--noise_sigma'])) if torch.cuda.is_available(): generator.cuda() image_discriminator.cuda() video_discriminator.cuda() print('The number of parameters for Video disciminator is : {0}'.format( count_parameters(video_discriminator))) summary((3, 64, 64, 16), video_discriminator) trainer = Trainer(image_loader, video_loader, int(args['--print_every']), int(args['--batches']), args['<log_folder>'], use_cuda=torch.cuda.is_available(), use_infogan=args['--use_infogan'], use_categories=args['--use_categories']) trainer.train(generator, image_discriminator, video_discriminator)
def summary(self, size=30): return summary(self.get_markdown(), size)