增加resume提示

This commit is contained in:
Stardust·减
2023-09-04 22:20:21 +08:00
committed by GitHub
parent 36b15ba514
commit 8f9884d6a6

View File

@@ -22,7 +22,7 @@ def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False
if optimizer is not None and not skip_optimizer and checkpoint_dict['optimizer'] is not None:
optimizer.load_state_dict(checkpoint_dict['optimizer'])
elif optimizer is None and not skip_optimizer:
#else: #Disable this line if Infer ,and enable the line upper
#else: Disable this line if Infer and resume checkpoint,then enable the line upper
new_opt_dict = optimizer.state_dict()
new_opt_dict_params = new_opt_dict['param_groups'][0]['params']
new_opt_dict['param_groups'] = checkpoint_dict['optimizer']['param_groups']