trainer.test(model) on 0.8.4 with a checkpoint saved in 0.6.0 expects attribute 'checkpoint_callback_best_model_path'
🐛 Bug
To Reproduce
Steps to reproduce the behavior:

Save a checkpoint in 0.6.0
Load the model in 0.8.4 (no problem)
model = My_model.load_from_checkpoint(checkpoint_path)
Run trainer.test(model) 
See error

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-eb476187792a> in <module>
     84 
     85 
---> 86 trainer.test(model)
     87 print("Test finished!\n")

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py in test(self, model, test_dataloaders, ckpt_path)
   1240         if model is not None:
   1241             self.model = model
-> 1242             self.fit(model)
   1243 
   1244         # on tpu, .spawn means we don't have a trained model

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders)
    977 
    978         elif self.single_gpu:
--> 979             self.single_gpu_train(model)
    980 
    981         elif self.use_tpu:  # pragma: no-cover

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/distrib_parts.py in single_gpu_train(self, model)
    183             self.reinit_scheduler_properties(self.optimizers, self.lr_schedulers)
    184 
--> 185         self.run_pretrain_routine(model)
    186 
    187     def tpu_train(self, tpu_core_idx, model):

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/trainer.py in run_pretrain_routine(self, model)
   1110 
   1111         # restore training and model before hpc call
-> 1112         self.restore_weights(model)
   1113 
   1114         # when testing requested only run test and return

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/training_io.py in restore_weights(self, model)
    180         if not did_restore_hpc_weights:
    181             if self.resume_from_checkpoint is not None:
--> 182                 self.restore(self.resume_from_checkpoint, on_gpu=self.on_gpu)
    183 
    184         # wait for all models to restore weights

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/training_io.py in restore(self, checkpoint_path, on_gpu)
    312 
    313         # load training state (affects trainer only)
--> 314         self.restore_training_state(checkpoint)
    315 
    316     def dump_checkpoint(self, weights_only: bool = False) -> dict:

~/.conda/envs/qwe3/lib/python3.6/site-packages/pytorch_lightning/trainer/training_io.py in restore_training_state(self, checkpoint)
    427                 )
    428                 checkpoint_callbacks[-1].best_model_score = checkpoint['checkpoint_callback_best']
--> 429             checkpoint_callbacks[-1].best_model_path = checkpoint['checkpoint_callback_best_model_path']
    430 
    431         if early_stopping_callbacks:

KeyError: 'checkpoint_callback_best_model_path'

But checkpoint's attribute ''checkpoint_callback_best_model_path' doesn't exist in my old PTL version...

Temporal Hack


Load the model
checkpoint_path = 'lightning_logs/version_149/checkpoints/_ckpt_epoch_3.ckpt'
checkpoint = torch.load(checkpoint_path)


Add a dummy path to the required argument
checkpoint['checkpoint_callback_best_model_path'] = ''


Save this checkpoint
torch.save(checkpoint, checkpoint_path)


Load from the new checkpoint in 0.8.4 and run trainer.test(model) without any problem


Environment

PyTorch Version: 1.5.1
OS: Linux
How you installed PyTorch: conda
Python version: 3.6.10
CUDA/cuDNN version: 10.2
GPU models and configuration: Tesla V100-SXM3-32GB

Probably I am misunderstanding something, but this is my quick fix, thanks for your help!