"vscode:/vscode.git/clone" did not exist on "4c4b323c1ff5f4cece9b115e60b21655ed551127"
Commit 3bbdc554 authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Update --restore-file logic (partially fixes #999)

Summary: Pull Request resolved: https://github.com/pytorch/fairseq/pull/1007

Differential Revision: D16762490

Pulled By: myleott

fbshipit-source-id: d67137bcf581887850323d188bb4ea643a35ac9e
parent c0a5d29e
......@@ -97,10 +97,10 @@ def load_checkpoint(args, trainer):
if args.distributed_rank == 0:
os.makedirs(args.save_dir, exist_ok=True)
if os.path.isabs(args.restore_file):
checkpoint_path = args.restore_file
if args.restore_file == 'checkpoint_last.pt':
checkpoint_path = os.path.join(args.save_dir, 'checkpoint_last.pt')
else:
checkpoint_path = os.path.join(args.save_dir, args.restore_file)
checkpoint_path = args.restore_file
extra_state = trainer.load_checkpoint(
checkpoint_path,
......
......@@ -361,7 +361,8 @@ def add_checkpoint_args(parser):
group.add_argument('--save-dir', metavar='DIR', default='checkpoints',
help='path to save checkpoints')
group.add_argument('--restore-file', default='checkpoint_last.pt',
help='filename in save-dir from which to load checkpoint')
help='filename from which to load checkpoint '
'(default: <save-dir>/checkpoint_last.pt')
group.add_argument('--reset-dataloader', action='store_true',
help='if set, does not reload dataloader state from the checkpoint')
group.add_argument('--reset-lr-scheduler', action='store_true',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment