From ed2e04946833c279db754436935ca54deddded00 Mon Sep 17 00:00:00 2001 From: MeowZheng Date: Thu, 15 Sep 2022 11:02:49 +0800 Subject: [PATCH 1/2] [Refactor]Resume do not specify ckpt --- tools/train.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tools/train.py b/tools/train.py index 8c1e5c7da6..248dfaec04 100644 --- a/tools/train.py +++ b/tools/train.py @@ -18,12 +18,8 @@ def parse_args(): parser.add_argument('--work-dir', help='the dir to save logs and models') parser.add_argument( '--resume', - nargs='?', - type=str, - const='auto', - help='If specify checkpoint path, resume from it, while if not ' - 'specify, try to auto resume from the latest checkpoint ' - 'in the work directory.') + action='store_true', + help='resume from the latest checkpoint in the work_dir automatically') parser.add_argument( '--amp', action='store_true', @@ -90,12 +86,7 @@ def main(): cfg.optim_wrapper.loss_scale = 'dynamic' # resume training - if args.resume == 'auto': - cfg.resume = True - cfg.load_from = None - elif args.resume is not None: - cfg.resume = True - cfg.load_from = args.resume + cfg.resume = args.resume # build the runner from config if 'runner_type' not in cfg: From e8626e50ef0bc24161a77da389b1f53cdc19d670 Mon Sep 17 00:00:00 2001 From: MeowZheng Date: Thu, 15 Sep 2022 14:07:43 +0800 Subject: [PATCH 2/2] add default false value --- tools/train.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/train.py b/tools/train.py index 248dfaec04..172815a9fe 100644 --- a/tools/train.py +++ b/tools/train.py @@ -19,6 +19,7 @@ def parse_args(): parser.add_argument( '--resume', action='store_true', + default=False, help='resume from the latest checkpoint in the work_dir automatically') parser.add_argument( '--amp',