| 335 | self.print_fn(f"model saved: {save_filename}") |
| 336 | |
| 337 | def load_model(self, load_path): |
| 338 | checkpoint = torch.load(load_path) |
| 339 | |
| 340 | self.model.load_state_dict(checkpoint['model']) |
| 341 | self.optimizer.load_state_dict(checkpoint['optimizer']) |
| 342 | self.scheduler.load_state_dict(checkpoint['scheduler']) |
| 343 | self.it = checkpoint['it'] |
| 344 | self.ema_model.load_state_dict(checkpoint['ema_model']) |
| 345 | self.print_fn('model loaded') |
| 346 | |
| 347 | def interleave_offsets(self, batch, nu): |
| 348 | groups = [batch // (nu + 1)] * (nu + 1) |