Skip to content

Unnecessary warning when resuming training #8833

@eladsegal

Description

@eladsegal

🐛 Bug

When training is resumed with resume_from_checkpoint, a warning is given about missing callbacks even if the expected callbacks are included.

I got the following:

UserWarning: Be aware that when using ``resume_from_checkpoint``, 
callbacks used to create the checkpoint need to be provided. 
Please, add the following callbacks: ['BetterModelCheckpoint', 'FreezeUnfreeze']

when the relevant variables had these values:

current_callbacks_type: {<class 'src.callbacks.model_checkpoint.BetterModelCheckpoint'>, 
<class 'src.callbacks.freeze_unfreeze.FreezeUnfreeze'>, ...}
saved_callbacks_type: {'BetterModelCheckpoint', 'FreezeUnfreeze'}

From a quick look, it seems that the source of the bug is that in current_callbacks_type there are types, and in saved_callbacks_type there are strings from Callback.state_id (which is .__qualname__ of the type).

https://github.com/PyTorchLightning/pytorch-lightning/blob/3096ab88ebb1d9c9c07c3230829171925c9e678a/pytorch_lightning/trainer/callback_hook.py#L277-L286


Sorry I didn't follow the template for reporting bugs. If this isn't enough, I'll be able to update the issue in a few days.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions