(checkpoint_file, model, optimizer, lr)
| 60 | |
| 61 | |
| 62 | def load_checkpoint(checkpoint_file, model, optimizer, lr): |
| 63 | print("=> Loading checkpoint") |
| 64 | checkpoint = torch.load(checkpoint_file, map_location=config.DEVICE) |
| 65 | model.load_state_dict(checkpoint["state_dict"]) |
| 66 | optimizer.load_state_dict(checkpoint["optimizer"]) |
| 67 | |
| 68 | # If we don't do this then it will just have learning rate of old checkpoint |
| 69 | # and it will lead to many hours of debugging \: |
| 70 | for param_group in optimizer.param_groups: |
| 71 | param_group["lr"] = lr |
nothing calls this directly
no outgoing calls
no test coverage detected