Do general housekeeping and keep the state of the context up-to-date. Should be called often enough but not in a tight loop.
(self, loss: Any = 0, cur_epoch: Any = 0, max_epoch: Any = None)
| 59 | self.close() |
| 60 | |
| 61 | def update(self, loss: Any = 0, cur_epoch: Any = 0, max_epoch: Any = None) -> None: |
| 62 | """Do general housekeeping and keep the state of the context up-to-date. |
| 63 | Should be called often enough but not in a tight loop.""" |
| 64 | assert not self.has_closed |
| 65 | |
| 66 | self.last_update_interval = time.time() - self.last_update_time |
| 67 | self.last_update_time = time.time() |
| 68 | |
| 69 | if os.path.exists(os.path.join(self.submit_config.run_dir, "abort.txt")): |
| 70 | self.should_stop_flag = True |
| 71 | |
| 72 | max_epoch_val = self.max_epoch if max_epoch is None else max_epoch |
| 73 | |
| 74 | def should_stop(self) -> bool: |
| 75 | """Tell whether a stopping condition has been triggered one way or another.""" |
no outgoing calls
no test coverage detected