(self)
Launch training procedures

            List of the hooks:

            - train_on_start: before the full training procedure
Launch training procedures
Launch training procedures
def train(self):
        """ Launch training procedures

            List of the hooks:

            - train_on_start: before the full training procedure

        """
        Logger()('Launching training procedures')

        self.hook('train_on_start')
        while self.epoch < Options()['engine']['nb_epochs']:
            self.train_epoch(self.model, self.dataset['train'], self.optimizer, self.epoch)

            if Options()['dataset']['eval_split']:
                out = self.eval_epoch(self.model, self.dataset['eval'], self.epoch)

                if 'saving_criteria' in Options()['engine'] and Options()['engine']['saving_criteria'] is not None:
                    for saving_criteria in Options()['engine']['saving_criteria']:
                        if self.is_best(out, saving_criteria):
                            name = saving_criteria.split(':')[0]
                            Logger()('Saving best checkpoint for strategy {}'.format(name))
                            self.save(Options()['exp']['dir'], 'best_{}'.format(name), self.model, self.optimizer)

            Logger()('Saving last checkpoint')
            self.save(Options()['exp']['dir'], 'last', self.model, self.optimizer)
            self.epoch += 1

        Logger()('Ending training procedures')
def train ( self ) : Logger ( ) ( 'Launching training procedures' ) self . hook ( 'train_on_start' ) while self . epoch < Options ( ) [ 'engine' ] [ 'nb_epochs' ] : self . train_epoch ( self . model , self . dataset [ 'train' ] , self . optimizer , self . epoch ) if Options ( ) [ 'dataset' ] [ 'eval_split' ] : out = self . eval_epoch ( self . model , self . dataset [ 'eval' ] , self . epoch ) if 'saving_criteria' in Options ( ) [ 'engine' ] and Options ( ) [ 'engine' ] [ 'saving_criteria' ] is not None : for saving_criteria in Options ( ) [ 'engine' ] [ 'saving_criteria' ] : if self . is_best ( out , saving_criteria ) : name = saving_criteria . split ( ':' ) [ 0 ] Logger ( ) ( 'Saving best checkpoint for strategy {}' . format ( name ) ) self . save ( Options ( ) [ 'exp' ] [ 'dir' ] , 'best_{}' . format ( name ) , self . model , self . optimizer ) Logger ( ) ( 'Saving last checkpoint' ) self . save ( Options ( ) [ 'exp' ] [ 'dir' ] , 'last' , self . model , self . optimizer ) self . epoch += 1 Logger ( ) ( 'Ending training procedures' )