question: KeyError: 'Trying to restore training state but checkpoint contains only the model. This is probably due to `ModelCheckpoint.save_weights_only` being set to `True`.'
context: this is my code:
  checkpoint_callback = ModelCheckpoint(
      monitor='hmean',
      mode='max',
      dirpath='../weights',
      filename='DB-{epoch:02d}-{hmean:.2f}',
      save_last=True,
      save_weights_only=True,
  )
  trainer = pl.Trainer(
      # open this, must drop last
      benchmark=True,
      checkpoint_callback=True,
      gpus=[0],
      max_epochs=1200,
      min_epochs=300,
      logger=[logger],
      callbacks=[early_stop, checkpoint_callback],
      resume_from_checkpoint='../weights/DB-epoch=130-hmean=0.70.ckpt'
  )
  
  when i try resume train from checkpoint, i got this error: KeyError: 'Trying to restore training state but checkpoint contains only the model. This is probably due to ModelCheckpoint.save_weights_only being set to True.'
answer: if you set save_weights_only=True in ModelCheckpoint then it won't save optimizer/scheduler states in an ideal case. So assigning this checkpoint to resume training won't work because it needs to restore optimizer/scheduler state as well to actually resume it.