Manager¶
-
class
hdnnpy.training.manager.
Manager
(tag, trainer, result, is_snapshot=True)[source]¶ Bases:
contextlib.AbstractContextManager
Context manager to take trainer snapshot and decide whether to train or not.
Parameters: - tag (str) – Tag of dataset used for training.
- trainer (Trainer) – Trainer object to be managed.
- result (dict) – Dictionary object containing total elapsed time and metrics value corresponding to the type of loss function. Even when training is stopped / resumed, it is retained.
- is_snapshot (bool, optional) – Take trainer snapshot if True.
-
__exit__
(type_, value, traceback)[source]¶ Restore signal handler of SIGINT and SIGTERM, and record the result of training.
-
check_to_resume
(resume_tag)[source]¶ Decide whether to train or not.
If current tag of dataset is equal to
resume_tag
, restore the state of trainer from snapshot file.Parameters: resume_tag (str) – Tag of dataset when snapshot was taken last time.
-
allow_to_run
¶ Whether the given trainer can train with the dataset.