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

Function load_checkpoint

ProGAN/demo.py:261–270  ·  view source on GitHub ↗
(checkpoint_file, model, optimizer, lr)

Source from the content-addressed store, hash-verified

259
260
261def load_checkpoint(checkpoint_file, model, optimizer, lr):
262 print("=> Loading checkpoint")
263 checkpoint = torch.load(checkpoint_file, map_location="cuda")
264 model.load_state_dict(checkpoint["state_dict"])
265 optimizer.load_state_dict(checkpoint["optimizer"])
266
267 # If we don't do this then it will just have learning rate of old checkpoint
268 # and it will lead to many hours of debugging \:
269 for param_group in optimizer.param_groups:
270 param_group["lr"] = lr
271
272def seed_everything(seed=42):
273 os.environ['PYTHONHASHSEED'] = str(seed)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected