| 251 | self.running_start_idx += b |
| 252 | |
| 253 | def save(self): |
| 254 | |
| 255 | # Softmax over preds |
| 256 | preds = torch.from_numpy(self.all_preds) |
| 257 | preds = torch.nn.Softmax(dim=-1)(preds) |
| 258 | self.all_preds = preds.numpy() |
| 259 | |
| 260 | pred_path = self.save_path + '.pth' |
| 261 | print(f'Saving all predictions to {pred_path}') |
| 262 | |
| 263 | torch.save(self.all_preds, pred_path) |
| 264 | |
| 265 | if self.all_labels is not None: |
| 266 | |
| 267 | # Evaluate |
| 268 | self.evaluate() |
| 269 | torch.save(self.all_labels, self.save_path + '_labels.pth') |
| 270 | |
| 271 | def evaluate(self): |
| 272 | |