MCPcopy
hub / github.com/Tencent/NeuralNLP-NeuralClassifier / load_checkpoint

Function load_checkpoint

train.py:188–194  ·  view source on GitHub ↗
(file_name, conf, model, optimizer)

Source from the content-addressed store, hash-verified

186
187
188def load_checkpoint(file_name, conf, model, optimizer):
189 checkpoint = torch.load(file_name)
190 conf.train.start_epoch = checkpoint["epoch"]
191 best_performance = checkpoint["best_performance"]
192 model.load_state_dict(checkpoint["state_dict"])
193 optimizer.load_state_dict(checkpoint["optimizer"])
194 return best_performance
195
196
197def save_checkpoint(state, file_prefix):

Callers 1

trainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected