Skip to content

Commit

Permalink
Fix epoch reporting when restoring checkpoint (#1075)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: fairinternal/fairseq-py#1075

Differential Revision: D20322672

Pulled By: myleott

fbshipit-source-id: 8845a10b10442bed77670b7740afa271123a3b5d
  • Loading branch information
myleott authored and facebook-github-bot committed Mar 7, 2020
1 parent adb5b9c commit 86916e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fairseq/checkpoint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _upgrade_state_dict(state):
state["args"].dataset_impl = "lazy"
# epochs start at 1
state["extra_state"]["train_iterator"]["epoch"] = max(
getattr(state["extra_state"]["train_iterator"], "epoch", 1),
state["extra_state"]["train_iterator"].get("epoch", 1),
1,
)

Expand Down

0 comments on commit 86916e0

Please sign in to comment.