code/utils.py
def save_checkpoint(self, val_loss, model,num_epoch):
        '''Saves model when validation loss decrease.'''
        if self.verbose:
            print(f'Validation loss decreased ({self.val_loss_min:.6f} --> {val_loss:.6f}).  Saving model ...')
        # torch.save(model.state_dict(), '.\output\model\checkpoint%d.pt' % num_epoch )
        torch.save(model.state_dict(), self.savepath + '/valid_best_checkpoint.pth') # save model parameters
        # torch.save(model, self.savepath + '/valid_best_checkpoint.pth') # save whole model
        self.val_loss_min = val_loss
Saves model when validation loss decrease.
Saves model when validation loss decrease.
Saves model when validation loss decrease .
def save_checkpoint(self, val_loss, model,num_epoch):
        if self.verbose:
            print(f'Validation loss decreased ({self.val_loss_min:.6f} --> {val_loss:.6f}).  Saving model ...')
        torch.save(model.state_dict(), self.savepath + '/valid_best_checkpoint.pth') 
        self.val_loss_min = val_loss
def save_checkpoint ( self , val_loss , model , num_epoch ) : if self . verbose : print ( f'Validation loss decreased ({self.val_loss_min:.6f} --> {val_loss:.6f}).  Saving model ...' ) torch . save ( model . state_dict ( ) , self . savepath + '/valid_best_checkpoint.pth' ) self . val_loss_min = val_loss
Saves model when validation loss decrease.
Saves model when validation loss decrease .
'''Saves model when validation loss decrease.''' # torch.save(model.state_dict(), '.\output\model\checkpoint%d.pt' % num_epoch ) # save model parameters # torch.save(model, self.savepath + '/valid_best_checkpoint.pth') # save whole model
self
val_loss
model
num_epoch