:param model: :param epoch: :return:
(model,optimizer,epoch)
| 19 | |
| 20 | #保存模型 |
| 21 | def save_model(model,optimizer,epoch): |
| 22 | """ |
| 23 | :param model: |
| 24 | :param epoch: |
| 25 | :return: |
| 26 | """ |
| 27 | print("=> Saving checkpoint") |
| 28 | checkpoint = { |
| 29 | "state_dict": model.state_dict(), |
| 30 | "optimizer": optimizer.state_dict(), |
| 31 | } |
| 32 | torch.save(checkpoint, os.path.join(config.SAVE_MODELS,str(epoch)+'gen.tar')) |
| 33 | |
| 34 | |
| 35 | def load_checkpoin(checkpoint_file, model, optimizer, lr): |
nothing calls this directly
no outgoing calls
no test coverage detected