(self, root_folder, experiment_name, hyperparams, iter_nr, info=None)
| 399 | |
| 400 | |
| 401 | def save(self, root_folder, experiment_name, hyperparams, iter_nr, info=None): |
| 402 | name=str(iter_nr) |
| 403 | if info is not None: |
| 404 | name+="_"+info |
| 405 | models_path = os.path.join(root_folder, experiment_name, name, "models") |
| 406 | if not os.path.exists(models_path): |
| 407 | os.makedirs(models_path, exist_ok=True) |
| 408 | torch.save(self.state_dict(), os.path.join(models_path, "strand_codec.pt")) |
| 409 | |
| 410 | hyperparams_params_path=os.path.join(models_path, "hyperparams.json") |
| 411 | with open(hyperparams_params_path, 'w', encoding='utf-8') as f: |
| 412 | json.dump(vars(hyperparams), f, ensure_ascii=False, indent=4) |
| 413 | |
| 414 | |
| 415 | def forward(self, gt_dict, hyperparams, normalization_dict): |
no test coverage detected