Commit 39bbc9a5 authored by Myle Ott's avatar Myle Ott Committed by Facebook Github Bot
Browse files

Fixes checkpointing bug introduced in 89e077c3

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

Differential Revision: D16075498

Pulled By: myleott

fbshipit-source-id: 62e27a8c4764f53f181c502674dfab1e6b0537e2
parent b6d420c2
...@@ -54,7 +54,7 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss): ...@@ -54,7 +54,7 @@ def save_checkpoint(args, trainer, epoch_itr, val_loss):
prev_best = getattr(save_checkpoint, 'best', val_loss) prev_best = getattr(save_checkpoint, 'best', val_loss)
if val_loss is not None: if val_loss is not None:
save_checkpoint.best = is_better(val_loss, prev_best) save_checkpoint.best = val_loss if is_better(val_loss, prev_best) else prev_best
extra_state = { extra_state = {
'train_iterator': epoch_itr.state_dict(), 'train_iterator': epoch_itr.state_dict(),
'val_loss': val_loss, 'val_loss': val_loss,
......
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