de75ff9237213fba6478fdbbaaff8e97749eab62,utils.py,Trainer,save,#Trainer#,59
Before Change
self.save(ep)
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):
def __init__(self, optimizer, last_epoch=-1):
if not isinstance(optimizer, Optimizer):
raise TypeError("{} is not an Optimizer".format(
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: 5
Non-data size: 3
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: Shawn1993/cnn-text-classification-pytorch
Commit Name: 75cee562b41f9d7c57b9b6fe60142fa198364aff
Time: 2020-03-19
Author: rriva002@ucr.edu
File Name: cnn_text_classification.py
Class Name: CNNClassifier
Method Name: fit
Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: ac7bb33dd978e2bf6ecb0cf055dd6bf6c9c1ea05
Time: 2019-04-19
Author: eriklindernoren@live.se
File Name: train.py
Class Name:
Method Name:
Project Name: ncullen93/torchsample
Commit Name: 15ac1c2bb2627bb8fbb89b0b64709e9a50be02fd
Time: 2017-05-13
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: ToFile
Method Name: __call__
Project Name: moskomule/senet.pytorch
Commit Name: 60f86864a6da5a746f9ae51f73ccfdeb29e6b35f
Time: 2018-03-06
Author: hataya@keio.jp
File Name: utils.py
Class Name: Trainer
Method Name: save