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

Method _load_checkpoint

predict.py:65–70  ·  view source on GitHub ↗
(file_name, model, use_cuda)

Source from the content-addressed store, hash-verified

63
64 @staticmethod
65 def _load_checkpoint(file_name, model, use_cuda):
66 if use_cuda:
67 checkpoint = torch.load(file_name, weights_only=True)
68 else:
69 checkpoint = torch.load(file_name, weights_only=True, map_location=lambda storage, loc: storage)
70 model.load_state_dict(checkpoint["state_dict"])
71
72 def predict(self, texts):
73 """

Callers 1

__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected