flops-counter.pytorch icon indicating copy to clipboard operation
flops-counter.pytorch copied to clipboard

Error when loading from a saved checkpoint file

Open PlumedSerpent opened this issue 5 years ago • 1 comments

Hi, I have a training script with structure as : model=Net() flops, params = get_model_complexity_info(model, (3, 256, 256), as_strings=True, print_per_layer_stat=True) print('Flops: ' + flops) print('Params: ' + params) training torch.save(model) Then when I tried to load from above saved checkpoint using torch.load('checkpoint.pth'), it occurs into an error: AttributeError: 'Net' object has no attribute 'start_flops_count'. Do you have any idea why I get this error and how can i solve it?

PlumedSerpent avatar Dec 02 '19 14:12 PlumedSerpent

Hi! Please take a look to the pytorch guidelines for saving models: https://pytorch.org/docs/stable/notes/serialization.html#recommend-saving-models

sovrasov avatar Dec 03 '19 11:12 sovrasov