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

Function save_checkpoint

StyleGAN/utils.py:58–64  ·  view source on GitHub ↗
(model, optimizer, filename="models/my_checkpoint.pth.tar")

Source from the content-addressed store, hash-verified

56
57#保存模型,通常的做法
58def save_checkpoint(model, optimizer, filename="models/my_checkpoint.pth.tar"):
59 print("=> Saving checkpoint")
60 checkpoint = {
61 "state_dict": model.state_dict(),
62 "optimizer": optimizer.state_dict(),
63 }
64 torch.save(checkpoint, filename)
65
66
67#加载模型

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected