MCPcopy Index your code
hub / github.com/InternScience/InternAgent / save_model

Method save_model

tasks/AutoTPPR/code/experiment.py:384–394  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

382 self.best_model = self.model
383
384 def save_model(self, path):
385 if not os.path.exists(path):
386 os.mkdir(path)
387
388 if self.config is None:
389 raise ValueError('No model is initialized...')
390
391 with open(os.path.join(path, 'config.pkl'), 'wb') as f:
392 pickle.dump(self.config, f)
393
394 torch.save(self.best_model.state_dict(), os.path.join(path, 'model.pt'))
395
396
397 def train(self, epochs = 20,

Callers 1

mainFunction · 0.95

Calls 3

state_dictMethod · 0.80
dumpMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected