ding.framework.middleware.ckpt_handler¶
ding.framework.middleware.ckpt_handler
¶
CkptSaver
¶
Overview
The class used to save checkpoint data.
__init__(policy, save_dir, train_freq=None, save_finish=True)
¶
Overview
Initialize the CkptSaver.
Arguments:
- policy (:obj:Policy): Policy used to save the checkpoint.
- save_dir (:obj:str): The directory path to save ckpt.
- train_freq (:obj:int): Number of training iterations between each saving checkpoint data.
- save_finish (:obj:bool): Whether save final ckpt when task.finish = True.
__call__(ctx)
¶
Overview
The method used to save checkpoint data. The checkpoint data will be saved in a file in following 3 cases: - When a multiple of self.train_freq iterations have elapsed since the beginning of training; - When the evaluation episode return is the best so far; - When task.finish is True.
Input of ctx:
- train_iter (:obj:int): Number of training iteration, i.e. the number of updating policy related network.
- eval_value (:obj:float): The episode return of current iteration.
Full Source Code
../ding/framework/middleware/ckpt_handler.py