Skip to content

Commit

Permalink
Resume from the latest checkpoint automatically (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCMax authored Mar 22, 2022
1 parent 4834250 commit 1f906cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 '
Expand Down

0 comments on commit 1f906cf

Please # to comment.