| 45 | |
| 46 | |
| 47 | def load_checkpoint(checkpoint_file, model, optimizer, lr): |
| 48 | print("=> Loading checkpoint") |
| 49 | checkpoint = torch.load(checkpoint_file, map_location=config.DEVICE) |
| 50 | model.load_state_dict(checkpoint["state_dict"]) |
| 51 | optimizer.load_state_dict(checkpoint["optimizer"]) |
| 52 | |
| 53 | # If we don't do this then it will just have learning rate of old checkpoint |
| 54 | # and it will lead to many hours of debugging \: |
| 55 | for param_group in optimizer.param_groups: |
| 56 | param_group["lr"] = lr |
| 57 | |
| 58 | |
| 59 | def plot_examples(low_res_folder, gen): |