MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / load_checkpoint

Function load_checkpoint

fc-CGANCode/utils.py:61–70  ·  view source on GitHub ↗
(checkpoint_file, model, optimizer, lr)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected