Skip to content

Commit

Permalink
fix: crash when save path was not provided
Browse files Browse the repository at this point in the history
Former-commit-id: 6c2fc531fdcfd31e325c7233a61804c4a690893d
  • Loading branch information
Javi Ribera committed Mar 21, 2018
1 parent 2623eaf commit 24b8cee
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions object-locator/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,18 @@ def parse_command_args(training_or_testing):
raise NotImplementedError('Only a batch size of 1 is implemented for now, got %s'
% args.eval_batch_size)

# Check we are not overwriting a checkpoint without resume from it
if args.save and os.path.isfile(args.save) and \
# Convert to full path
if args.save != '':
args.save = os.path.abspath(args.save)

# Check we are not overwriting a checkpoint without resuming from it
if args.save != '' and os.path.isfile(args.save) and \
not (args.resume and args.resume == args.save):
print("E: Don't overwrite a checkpoint without resuming from it. "
"Are you sure you want to do that? "
"(if you do, remove it manually).")
exit(1)

# Convert to full path
args.save = os.path.abspath(args.save)

args.cuda = not args.no_cuda and torch.cuda.is_available()

elif training_or_testing == 'testing':
Expand Down

0 comments on commit 24b8cee

Please sign in to comment.