Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
foamliu committed Oct 11, 2018
1 parent 37b8f87 commit 6907e21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ def ensure_folder(folder):
os.makedirs(folder)


def save_checkpoint(epoch, encoder, optimizer, val_loss, is_best):
def save_checkpoint(epoch, encoder, optimizer, val_acc, is_best):
ensure_folder(save_folder)
state = {'encoder': encoder,
'optimizer': optimizer}

if is_best:
filename = '{0}/checkpoint_{1}_{2:.3f}.tar'.format(save_folder, epoch, val_loss)
filename = '{0}/checkpoint_{1}_{2:.3f}.tar'.format(save_folder, epoch, val_acc)
torch.save(state, filename)

# If this checkpoint is the best so far, store a copy so it doesn't get overwritten by a worse checkpoint
Expand Down

0 comments on commit 6907e21

Please sign in to comment.