(self, filename)
| 37 | |
| 38 | |
| 39 | def load(self, filename): |
| 40 | # filename : model path |
| 41 | if os.path.isfile(filename): |
| 42 | print('Loading checkpoint from "%s"\n' % filename) |
| 43 | checkpoint = torch.load(filename, map_location='cpu') |
| 44 | |
| 45 | self.start_epoch = checkpoint.start_epoch |
| 46 | self.start_iter = checkpoint.start_iter |
| 47 | self.train_loss = checkpoint.train_loss |
| 48 | self.eval_loss = checkpoint.eval_loss |
| 49 | |
| 50 | self.best_val_loss = checkpoint.best_val_loss |
| 51 | self.prev_val_loss = checkpoint.prev_val_loss |
| 52 | self.state_dict = checkpoint.state_dict |
| 53 | self.optimizer = checkpoint.optimizer |
| 54 | self.num_no_improv = checkpoint.num_no_improv |
| 55 | self.half_lr = checkpoint.half_lr |
| 56 | else: |
| 57 | raise ValueError('No checkpoint found at "%s"' % filename) |
| 58 | |
| 59 | class InstantLayerNorm1d(nn.Module): |
| 60 | def __init__(self, |
nothing calls this directly
no outgoing calls
no test coverage detected