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

Function save_checkpoint

Code/utils.py:16–22  ·  view source on GitHub ↗
(model,optimizer,filename = "my_checkpoint.pth.tar",epochs = 0)

Source from the content-addressed store, hash-verified

14import numpy as np
15
16def save_checkpoint(model,optimizer,filename = "my_checkpoint.pth.tar",epochs = 0):
17 print("=> Saving checkpoint")
18 checkpoint = {
19 "state_dict":model.state_dict(),
20 "optimizer":optimizer.state_dict(),
21 }
22 torch.save(checkpoint,filename + str(epochs))
23def load_checkpoin(checkpoint_file,model,optimizer,lr):
24 print("=> Loading checkpoint")
25 checkpoint = torch.load(checkpoint_file,map_location=config.DEVICE)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected