(self)
Runs a training loop on the model networks.
Runs a training loop on the model networks.
Runs a training loop on the model networks .
def train(self):
        """
        Runs a training loop on the model networks.
        """
        for i in xrange(self.num_steps):
            if c.ADVERSARIAL:
                # update discriminator
                batch = get_train_batch()
                print 'Training discriminator...'
                self.d_model.train_step(batch, self.g_model)

            # update generator
            batch = get_train_batch()
            print 'Training generator...'
            self.global_step = self.g_model.train_step(
                batch, discriminator=(self.d_model if c.ADVERSARIAL else None))

            # save the models
            if self.global_step % c.MODEL_SAVE_FREQ == 0:
                print '-' * 30
                print 'Saving models...'
                self.saver.save(self.sess,
                                c.MODEL_SAVE_DIR + 'model.ckpt',
                                global_step=self.global_step)
                print 'Saved models!'
                print '-' * 30

            # test generator model
            if self.global_step % c.TEST_FREQ == 0:
                self.test()
def train ( self ) : for i in xrange ( self . num_steps ) : if c . ADVERSARIAL : # update discriminator batch = get_train_batch ( ) print 'Training discriminator...' self . d_model . train_step ( batch , self . g_model ) # update generator batch = get_train_batch ( ) print 'Training generator...' self . global_step = self . g_model . train_step ( batch , discriminator = ( self . d_model if c . ADVERSARIAL else None ) ) # save the models if self . global_step % c . MODEL_SAVE_FREQ == 0 : print '-' * 30 print 'Saving models...' self . saver . save ( self . sess , c . MODEL_SAVE_DIR + 'model.ckpt' , global_step = self . global_step ) print 'Saved models!' print '-' * 30 # test generator model if self . global_step % c . TEST_FREQ == 0 : self . test ( )