Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 82509c7

Browse files
xianxlfacebook-github-bot
authored andcommitted
load checkpoint without extra state
Reviewed By: theweiho Differential Revision: D9651374 fbshipit-source-id: 8ae9249c9305954088c88f47e56e7f993b109f1a
1 parent e07df3c commit 82509c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytorch_translate/train.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ def setup_training_state(args, trainer, task):
228228
# ignore previous directory args and just use the absolute path as is.
229229
checkpoint_path = os.path.join(args.save_dir, args.restore_file)
230230
restore_state = True
231-
if os.path.exists(checkpoint_path):
231+
if os.path.isfile(checkpoint_path):
232232
print(
233233
f"| Using --save-dir={args.save_dir}, --restore-file={args.restore_file}."
234234
)
235-
elif args.pretrained_checkpoint_file and os.path.exists(
235+
elif args.pretrained_checkpoint_file and os.path.isfile(
236236
args.pretrained_checkpoint_file
237237
):
238238
checkpoint_path = args.pretrained_checkpoint_file

0 commit comments

Comments
 (0)