(self, path)
| 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, |
no test coverage detected