From 1f906cff0342d46d978ffd00a6f4d328a85b8f8a Mon Sep 17 00:00:00 2001 From: ChaimZhu Date: Tue, 22 Mar 2022 23:34:28 +0800 Subject: [PATCH] Resume from the latest checkpoint automatically (#1329) --- tools/train.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/train.py b/tools/train.py index 65bda34cb..ed9c2a6b4 100644 --- a/tools/train.py +++ b/tools/train.py @@ -36,6 +36,10 @@ def parse_args(): parser.add_argument('--work-dir', help='the dir to save logs and models') parser.add_argument( '--resume-from', help='the checkpoint file to resume from') + parser.add_argument( + '--auto-resume', + action='store_true', + help='resume from the latest checkpoint automatically') parser.add_argument( '--no-validate', action='store_true', @@ -133,6 +137,14 @@ def main(): osp.splitext(osp.basename(args.config))[0]) if args.resume_from is not None: cfg.resume_from = args.resume_from + + if args.auto_resume: + cfg.auto_resume = args.auto_resume + warnings.warn('`--auto-resume` is only supported when mmdet' + 'version >= 2.20.0 for 3D detection model or' + 'mmsegmentation verision >= 0.21.0 for 3D' + 'segmentation model') + if args.gpus is not None: cfg.gpu_ids = range(1) warnings.warn('`--gpus` is deprecated because we only support '