de75ff9237213fba6478fdbbaaff8e97749eab62,utils.py,Trainer,save,#Trainer#Any#,59
Before Change
def save(self, epoch, **kwargs):
if self.save_dir:
name = f"weight-{epoch}-" + "-".join([f"{k}_{v}" for k, v in kwargs.items()]) + ".pkl"
torch.save({"weight": self.model.state_dict()},
os.path.join(self.save_dir, name))
// copied from pytorch"s master
class _LRScheduler(object):
After Change
def save(self, epoch, **kwargs):
model_folder = "checkpoints/"
model_out_path = model_folder + "model_epoch_{}.pth".format(epoch)
state = {"epoch": epoch, "weight": self.model.state_dict()}
if not os.path.exists(model_folder):
os.makedirs(model_folder)
torch.save(state, model_out_path)
// copied from pytorch"s master
class _LRScheduler(object):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: moskomule/senet.pytorch
Commit Name: de75ff9237213fba6478fdbbaaff8e97749eab62
Time: 2017-12-17
Author: kfm@clfstudio.com
File Name: utils.py
Class Name: Trainer
Method Name: save
Project Name: stellargraph/stellargraph
Commit Name: 45842d387c7a1c009a1345052805a191afd32198
Time: 2018-08-14
Author: docherty@gmail.com
File Name: demos/node-classification/epgm-example.py
Class Name:
Method Name: train
Project Name: stellargraph/stellargraph
Commit Name: 45842d387c7a1c009a1345052805a191afd32198
Time: 2018-08-14
Author: docherty@gmail.com
File Name: demos/node-classification/epgm-yelp-example.py
Class Name:
Method Name: train