MCPcopy Create free account
hub / github.com/chengsen/PyTorch_TextGCN / save_checkpoint

Method save_checkpoint

utils.py:195–201  ·  view source on GitHub ↗

Saves model when validation loss decrease.

(self, val_loss, model)

Source from the content-addressed store, hash-verified

193 self.counter = 0
194
195 def save_checkpoint(self, val_loss, model):
196 '''Saves model when validation loss decrease.'''
197 if self.verbose:
198 print(
199 f'Validation loss decreased ({self.val_loss_min:.6f} --> {val_loss:.6f}). Saving model ...')
200 th.save(model.state_dict(), self.model_path)
201 self.val_loss_min = val_loss
202
203 def load_model(self):
204 return th.load(self.model_path)

Callers

nothing calls this directly

Calls 1

saveMethod · 0.80

Tested by

no test coverage detected