(model,optimizer,filename = "my_checkpoint.pth.tar",epochs = 0)
| 14 | import numpy as np |
| 15 | |
| 16 | def 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)) |
| 23 | def load_checkpoin(checkpoint_file,model,optimizer,lr): |
| 24 | print("=> Loading checkpoint") |
| 25 | checkpoint = torch.load(checkpoint_file,map_location=config.DEVICE) |
nothing calls this directly
no outgoing calls
no test coverage detected