Incorrect "Saving latest checkpoint" warning
🐛 Bug
"Saving latest checkpoint..." warning appears regardless of whether a ModelCheckpoint exists or save_last is set to True

  
    
      pytorch-lightning/pytorch_lightning/trainer/training_loop.py
    
    
        Lines 167 to 169
      in
      a71d62d
    
  
  
    

        
          
           # Save latest checkpoint 
        

        
          
           rank_zero_warn('Saving latest checkpoint..') 
        

        
          
           self.check_checkpoint_callback(should_check_val=False, force_save=True) 
        
    
  



  
    
      pytorch-lightning/pytorch_lightning/trainer/training_loop.py
    
    
        Lines 196 to 204
      in
      a71d62d
    
  
  
    

        
          
           def check_checkpoint_callback(self, should_check_val, force_save=False): 
        

        
          
               model = self.trainer.get_model() 
        

        
          
            
        

        
          
               # when no val loop is present or fast-dev-run still need to call checkpoints 
        

        
          
               # TODO bake this logic into the checkpoint callback 
        

        
          
               should_activate = not is_overridden('validation_step', model) and not should_check_val 
        

        
          
               if should_activate or force_save: 
        

        
          
                   checkpoint_callbacks = [c for c in self.trainer.callbacks if isinstance(c, ModelCheckpoint)] 
        

        
          
                   [c.on_validation_end(self.trainer, model) for c in checkpoint_callbacks] 
        
    
  


This might confuse an user to think the last checkpoint got saved when it did not.
Proposed change:
def check_checkpoint_callback(self, should_check_val, force_save=False):
    model = self.trainer.get_model()

    # when no val loop is present or fast-dev-run still need to call checkpoints
    # TODO bake this logic into the checkpoint callback
    should_activate = not is_overridden('validation_step', model) and not should_check_val
    if should_activate or force_save:
        checkpoint_callbacks = [c for c in self.trainer.callbacks if isinstance(c, ModelCheckpoint)]
        if any(c.save_last for c in checkpoint_callbacks):
            rank_zero_warn('Saving latest checkpoint..')
        [c.on_validation_end(self.trainer, model) for c in checkpoint_callbacks]